[PATCH RFA] symfile.c bounds check
Kevin Buettner
kevinb@cygnus.com
Sat Mar 18 14:30:00 GMT 2000
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 */
More information about the Gdb-patches
mailing list