This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] genattrtab: avoid NULL-deref on error


On Sat, Apr 21, 2012 at 5:53 PM, Jim Meyering <jim@meyering.net> wrote:
> I see that no one responded when I posted this in February.
> Ok to commit, now?

Ok.

Thanks,
Richard.

> 2012-02-24 ?Jim Meyering ?<meyering@redhat.com>
>
> ? ? ? ?* genattrtab.c (gen_attr): Avoid NULL-deref after diagnosing
> ? ? ? ?absence of an define_enum call.
>
>
> diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
> index 4a4c2a2..bfbe3e8 100644
> --- a/gcc/genattrtab.c
> +++ b/gcc/genattrtab.c
> @@ -1,6 +1,6 @@
> ?/* Generate code from machine description to compute values of attributes.
> ? ?Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
> - ? 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
> + ? 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
> ? ?Free Software Foundation, Inc.
> ? ?Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
>
> @@ -2993,8 +2993,9 @@ gen_attr (rtx exp, int lineno)
> ? ? ? if (!et || !et->md_p)
> ? ? ? ?error_with_line (lineno, "No define_enum called `%s' defined",
> ? ? ? ? ? ? ? ? ? ? ? ? attr->name);
> - ? ? ?for (ev = et->values; ev; ev = ev->next)
> - ? ? ? add_attr_value (attr, ev->name);
> + ? ? ?if (et)
> + ? ? ? for (ev = et->values; ev; ev = ev->next)
> + ? ? ? ? add_attr_value (attr, ev->name);
> ? ? }
> ? else if (*XSTR (exp, 1) == '\0')
> ? ? attr->is_numeric = 1;
> --
> 1.7.10.228.g81f95


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]