catch out of range string offset in corrupt stab entry
authorNick Clifton <nickc@redhat.com>
Tue, 28 Mar 2000 01:11:27 +0000 (01:11 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 28 Mar 2000 01:11:27 +0000 (01:11 +0000)
binutils/ChangeLog
binutils/rddbg.c

index f314b1c6fd7245d8b5a8f992ecfc9625f692c5ec..304745e6fabcca70129361c1a0570978c8bd6049 100644 (file)
@@ -1,3 +1,8 @@
+2000-03-27  Nick Clifton  <nickc@cygnus.com>
+
+       * rddbg.c (read_section_stabs_debugging_info): Catch out of range
+       string offsets in corrupt stabs entries.
+
 2000-03-27  Alan Modra  <alan@linuxcare.com>
 
        * readelf.c: Include elf/avr.h
index 9428c37ad5ce713bf1c644e1cf317d6721892fc0..e26056e6cfc446adeee4c99cd3486a7886b8b529 100644 (file)
@@ -185,7 +185,17 @@ read_section_stabs_debugging_info (abfd, syms, symcount, dhandle, pfound)
                  char *f, *s;
 
                  f = NULL;
+                 
+                 if (stroff + strx > 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;
+                   }
+                 
                  s = (char *) strings + stroff + strx;
+                 
                  while (s[strlen (s) - 1] == '\\'
                         && stab + 12 < stabs + stabsize)
                    {