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
and m4-1.4.2/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
_______________________________________________
Bug-m4 mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-m4