From 3b7aaf81e12ebca815b5f977369cd7a7681274db Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 28 Mar 2000 01:11:27 +0000 Subject: [PATCH] catch out of range string offset in corrupt stab entry --- binutils/ChangeLog | 5 +++++ binutils/rddbg.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index f314b1c6fd7..304745e6fab 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2000-03-27 Nick Clifton + + * rddbg.c (read_section_stabs_debugging_info): Catch out of range + string offsets in corrupt stabs entries. + 2000-03-27 Alan Modra * readelf.c: Include elf/avr.h diff --git a/binutils/rddbg.c b/binutils/rddbg.c index 9428c37ad5c..e26056e6cfc 100644 --- a/binutils/rddbg.c +++ b/binutils/rddbg.c @@ -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) { -- 2.30.2