* 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
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;
}
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;