Bonjour,
J'ai développé un module pour Apache 2.2.4 et je rencontre un comportement aléatoire quand je modifie la valeur d'une variable défini à l'aide de #define. Cette variable me sert à définir une expression régulière :
==> Là, tout fonctionne parfaitement
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 #define EXP_REGU "<\\?xml version=\"1\\.0\" encoding=\"UTF-8\"\\?><endbRequest xmlns=\"UdbEndbInterface\" xmlns:xsi=\"http://www\\.w3\\.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"EndbInterface C:[\\]{1,2}endbRequest\\.xsd\"><Line-Id>(.{0}|[[:alnum:]]{20})</Line-Id><Operator-Code>(.{0}|[0-9]{2})</Operator-Code><Country-Code>(.{0}|[0-9]{2})</Country-Code><Location-Area-Code>(.{0}|[0-9]{5})</Location-Area-Code><Advanced-Location-Info>(.{0}|[[:alnum:]]{10})</Advanced-Location-Info><Calling>([0-9]{9,11})</Calling><Called>([0-9]{2,6})</Called></endbRequest>"
Je modifie légèrement le bazard (faire défiler à droite...)
==> Au lancement Apache sort en Segmentation Fault
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 #define EXP_REGU "<\\?xml version=\"1\\.0\" encoding=\"UTF-8\"\\?><endbRequest xmlns=\"UdbEndbInterface\" xmlns:xsi=\"http://www\\.w3\\.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"EndbInterface C:[\\]{1,2}endbRequest\\.xsd\"><Line-Id>(.{0}|[[:alnum:]]{20})</Line-Id><Operator-Code>(.{0}|[0-9]{2})</Operator-Code><Country-Code>(.{0}|[0-9]{2})</Country-Code><Location-Area-Code>(.{0}|[0-9]{5})</Location-Area-Code><Advanced-Location-Info>(.{0}|[[:alnum:]]{10})</Advanced-Location-Info><Calling>([0-9]{9,11})</Calling><Called>([0-9]{2,8})</Called></endbRequest>"
D'après gdb (debuger GNU), l'erreur viendrait du noyau Apache lui même :
Impossible de m'expliquer le pourquoi du comment...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 624 in main.c (gdb) n Program received signal SIGSEGV, Segmentation fault. 0x001b5f70 in _int_malloc () from /lib/tls/libc.so.6 (gdb) bt #0 0x001b5f70 in _int_malloc () from /lib/tls/libc.so.6 #1 0x001b50fd in malloc () from /lib/tls/libc.so.6 #2 0x00ef4722 in allocator_alloc (allocator=0x8aed008, size=8192) at memory/unix/apr_pools.c:300 #3 0x00ef3c27 in apr_pool_create_ex (newpool=0xbfffb4a8, parent=0x8af30a8, abort_fn=0, allocator=0x8aed008) at memory/unix/apr_pools.c:800 #4 0x080695c8 in ap_core_reorder_directories (p=0x8af30a8, s=0x2009) at core.c:631 #5 0x0806244d in main (argc=4, argv=0xbfffb5a4) at main.c:624
Je me demandais donc si le contenu de la variable défini par le #define ne partait pas quelque part en mémoire et débordait quelque part...
Existe-t-il une longueur maximum pour une variable défini par #define ?
Merci d'avance pour votre aide![]()
Partager