mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +00:00
diagnostics: fix invalid error message indentation
https://lists.gnu.org/archive/html/bison-patches/2019-08/msg00007.html When Bison is started with a flag that suppresses warning messages, the error_message() function can produce a few gigabytes of indentation because of a dangling pointer. * src/complain.c (error_message): Don't reset indent_ptr here, but... (complain_indent): here. * tests/diagnostics.at (Indentation with message suppression): Check this case.
This commit is contained in:
committed by
Akim Demaille
parent
d7cf3f5b18
commit
9145bd0b61
@@ -435,7 +435,6 @@ error_message (const location *loc, warnings flags, severity sever,
|
||||
*indent_ptr = pos;
|
||||
else if (*indent_ptr > pos)
|
||||
fprintf (stderr, "%*s", *indent_ptr - pos, "");
|
||||
indent_ptr = NULL;
|
||||
}
|
||||
|
||||
const char* style = severity_style (sever);
|
||||
@@ -506,6 +505,7 @@ complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
va_start (args, message);
|
||||
complains (loc, flags, message, args);
|
||||
va_end (args);
|
||||
indent_ptr = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user