summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getabbrev.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2005-08-02 01:24:01 +0000
committerRoland McGrath <[email protected]>2005-08-02 01:24:01 +0000
commita5a89687681ca81e82681b56612495c0d087829e (patch)
tree6f1fe82d9ef2f1cc864cfa4fdf84f240a448fa5b /libdw/dwarf_getabbrev.c
parent83fcb48e54b31230235e7dcc1b21b446ba3f5cc4 (diff)
2005-08-01 Roland McGrath <[email protected]>
* dwarf_getaranges.c (dwarf_getaranges): Check for bogus offset. * dwarf_getabbrev.c (__libdw_getabbrev): Likewise.
Diffstat (limited to 'libdw/dwarf_getabbrev.c')
-rw-r--r--libdw/dwarf_getabbrev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
index a6968a83..ecac0859 100644
--- a/libdw/dwarf_getabbrev.c
+++ b/libdw/dwarf_getabbrev.c
@@ -34,8 +34,15 @@ __libdw_getabbrev (dbg, cu, offset, lengthp, result)
if (dbg->sectiondata[IDX_debug_abbrev] == NULL)
return NULL;
+ if (offset >= dbg->sectiondata[IDX_debug_abbrev]->d_size)
+ {
+ __libdw_seterrno (DWARF_E_INVALID_OFFSET);
+ return NULL;
+ }
+
const unsigned char *abbrevp
= (unsigned char *) dbg->sectiondata[IDX_debug_abbrev]->d_buf + offset;
+
if (*abbrevp == '\0')
/* We are past the last entry. */
return DWARF_END_ABBREV;