[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using changeword in M4-1.4.1 can cause Segmentation Fault
From: |
Frank Schwidom |
Subject: |
Using changeword in M4-1.4.1 can cause Segmentation Fault |
Date: |
Wed, 24 Nov 2004 22:18:25 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 |
Dear Developers.
The following code causes an Segfault in M4 if it is compiled with the
'configure --enable-changeword' switch:
changequote( [, ])dnl
changeword( [[]])dnl
A
The Error resides in the following code in m4-1.4.1/src/input.c
...
set_word_regexp (const char *regexp)
{
int i;
char test[2];
const char *msg;
if (!strcmp (regexp, DEFAULT_WORD_REGEXP))
{
default_word_regexp = TRUE;
return;
}
default_word_regexp = FALSE; ///////////// <= rash status-Change (maybe)
msg = re_compile_pattern (regexp, strlen (regexp), &word_regexp);
if (msg != NULL) //////////////// Regexcompilation failed, and M4 is
after this function in an bad State
{
M4ERROR ((warning_status, 0,
"Bad regular expression `%s': %s", regexp, msg));
/////////// fix-suggestion1: here could stay: set_word_regexp(
old_regex); old_regex must be saved before and it must be clear that
this will not fail
/////////// fix-suggestion2: here could stay:
default_word_regexp = TRUE;
return; //////////// fix-suggestion3: here could be an 'exit(1)'
}
if (word_start == NULL)
word_start = xmalloc (256);
word_start[0] = '\0';
test[1] = '\0';
for (i = 1; i < 256; i++)
{
test[0] = i;
if (re_search (&word_regexp, test, 1, 0, 0, ®s) >= 0)
strcat (word_start, test);
}
}
...
Regards, Frank Schwidom
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Using changeword in M4-1.4.1 can cause Segmentation Fault,
Frank Schwidom <=