1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Fix a severe code generation bug occurring with option -c.

This commit is contained in:
Bruno Haible
2000-08-19 15:26:25 +00:00
parent 51e5c7f72c
commit 84663d7379
2 changed files with 8 additions and 1 deletions

View File

@@ -1,5 +1,10 @@
2000-08-19 Bruno Haible <bruno@linuix.math.u-bordeaux.fr>
* src/key-list.cc (Output_Compare_Strncmp::output_comparison):
After the call to strncmp, verify that expr2 is not longer than
`len'.
Reported by Carlo Wood <carlo@runaway.xs4all.nl>.
* src/key-list.cc (Key_List::output_lookup_function_body): Avoid
emitting the loop for dealing with duplicates if
total_duplicates == 0.

View File

@@ -805,7 +805,9 @@ void Output_Compare_Strncmp::output_comparison (const Output_Expr& expr1,
expr1.output_expr ();
printf (" + 1, ");
expr2.output_expr ();
printf (" + 1, len - 1)");
printf (" + 1, len - 1) && ");
expr2.output_expr ();
printf ("[len] == '\\0'");
}
/* ------------------------------------------------------------------------- */