This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Error detection fix for read-rtl.c
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 1 Apr 2010 23:20:44 +0000 (UTC)
- Subject: Error detection fix for read-rtl.c
I encountered a case where a mistake in a .md file caused genmddeps to
spin in a loop at EOF until it ran out of memory. This patch adds a
check for EOF in the relevant loop. Bootstrapped with no regressions
on x86_64-unknown-linux-gnu. OK to commit?
2010-04-01 Joseph Myers <joseph@codesourcery.com>
* read-rtl.c (read_rtx_1): Give an error for EOF while looking for
']'.
Index: read-rtl.c
===================================================================
--- read-rtl.c (revision 157794)
+++ read-rtl.c (working copy)
@@ -1595,6 +1595,8 @@ read_rtx_1 (FILE *infile, struct map_val
obstack_init (&vector_stack);
while ((c = read_skip_spaces (infile)) && c != ']')
{
+ if (c == EOF)
+ fatal_expected_char (infile, ']', c);;
ungetc (c, infile);
list_counter++;
obstack_ptr_grow (&vector_stack, read_rtx_1 (infile, mode_maps));
--
Joseph S. Myers
joseph@codesourcery.com