This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Catch out of range string offsets in corrupt stabs entries
- To: binutils at sourceware dot cygnus dot com
- Subject: Catch out of range string offsets in corrupt stabs entries
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Mon, 27 Mar 2000 17:04:08 -0800
Hi Guys,
Whilst debugging another problem I came across a case where "objdump
-g" would core dump if it was given some corrupt stabs entries to
display. This patch makes it detect the situation where the corrupt
entry has a bad string offset in it, and causes objdump to print a
meaningful error message instead of seg-faulting.
May I apply this patch ?
Cheers
Nick
2000-03-27 Nick Clifton <nickc@cygnus.com>
* rddbg.c (read_section_stabs_debugging_info): Catch out of range
string offsets in corrupt stab entries.
Index: binutils/rddbg.c
===================================================================
RCS file: /cvs/src//src/binutils/rddbg.c,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 rddbg.c
*** rddbg.c 1999/05/03 07:29:10 1.1.1.1
--- rddbg.c 2000/03/28 01:02:49
*************** read_section_stabs_debugging_info (abfd,
*** 186,191 ****
--- 186,200 ----
f = NULL;
s = (char *) strings + stroff + strx;
+
+ if (s > strings + strsize)
+ {
+ fprintf (stderr, "%s: %s: stab entry %d is corrupt, strx = 0x%x, type = %d\n",
+ bfd_get_filename (abfd), names[i].secname,
+ (stab - stabs) / 12, strx, type);
+ continue;
+ }
+
while (s[strlen (s) - 1] == '\\'
&& stab + 12 < stabs + stabsize)
{