diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | filter.c | 37 | ||||
-rw-r--r-- | flex.skl | 7 |
3 files changed, 40 insertions, 9 deletions
@@ -5,6 +5,11 @@ See the file COPYING for copying conditions. * after version 2.5.33 +** flex better escapes filenames with special characters in them +(resolves#1623600) + +** a memory leak was plugged(resolves bug #1601111) + ** pattern language expanded; see the manual for details on the below highlights @@ -354,24 +354,43 @@ int filter_fix_linedirs (struct filter *chain) num = regmatch_strtol (&m[1], buf, NULL, 0); fname = regmatch_dup (&m[2], buf); - if (strcmp - (fname, outfilename ? outfilename : "<stdout>") - == 0 - || strcmp (fname, - headerfilename ? headerfilename : - "<stdout>") == 0) { + if (strcmp (fname, + outfilename ? outfilename : "<stdout>") + == 0 + || strcmp (fname, + headerfilename ? headerfilename : "<stdout>") + == 0) { + + char *s1, *s2; + char filename[MAXLINE]; + + s1 = fname; + s2 = filename; + + while ((s2 - filename) < (MAXLINE - 1) && *s1) { + /* Escape the backslash */ + if (*s1 == '\\') + *s2++ = '\\'; + /* Escape the double quote */ + if (*s1 == '\"') + *s2++ = '\\'; + /* Copy the character as usual */ + *s2++ = *s1++; + } + + *s2 = '\0'; + /* Adjust the line directives. */ in_gen = true; snprintf (buf, readsz, "#line %d \"%s\"\n", - lineno + 1, fname); - free (fname); - + lineno + 1, filename); } else { /* it's a #line directive for code we didn't write */ in_gen = false; } + free (fname); last_was_blank = false; } @@ -1647,6 +1647,13 @@ m4_ifdef( [[M4_YY_USES_REJECT]], else ret_val = EOB_ACT_CONTINUE_SCAN; + if ((yy_size_t) (yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yy_n_chars + number_to_move + (yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size); + } + YY_G(yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; |