This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [PATCH RFA] symfile.c bounds check
- To: Kevin Buettner <kevinb at cygnus dot com>
- Subject: Re: [PATCH RFA] symfile.c bounds check
- From: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Date: 20 Mar 2000 15:32:17 -0500
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <1000318223035.ZM11861@ocotillo.lan>
Yes, please do.
> I was seeing rather severe problems (gdb coredumps; test suite
> wouldn't run at all) on linux/ppc after my recent solib.c changes.
> The following patch fixes these problems. (Also, since this is happening,
> MAX_SECTIONS needs to be even bigger. We probably just ought to
> redesign struct section_addr_info so that it can be dynamically sized.)
>
> May I check this in?
>
> * symfile.c (syms_from_objfile): Added bounds check prior to
> accessing ``other'' array in a section_addr_info struct.
>
> Index: symfile.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symfile.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 symfile.c
> --- symfile.c 2000/03/15 19:43:57 1.2
> +++ symfile.c 2000/03/18 22:18:53
> @@ -738,7 +790,9 @@ syms_from_objfile (objfile, addrs, mainl
> else if (strcmp (s->the_bfd_section->name, ".bss") == 0)
> s_addr = addrs->bss_addr;
> else
> - for (i = 0; !s_addr && addrs->other[i].name; i++)
> + for (i = 0;
> + !s_addr && i < MAX_SECTIONS && addrs->other[i].name;
> + i++)
> if (strcmp (s->the_bfd_section->name, addrs->other[i].name) == 0)
> s_addr = addrs->other[i].addr; /* end added for gdb/13815 */
>
>
>