* dwarf_getaranges.c (dwarf_getaranges): Check for bogus offset.
* dwarf_getabbrev.c (__libdw_getabbrev): Likewise.
+2005-08-01 Roland McGrath <roland@redhat.com>
+
+ * dwarf_getaranges.c (dwarf_getaranges): Check for bogus offset.
+ * dwarf_getabbrev.c (__libdw_getabbrev): Likewise.
+
2005-07-28 Ulrich Drepper <drepper@redhat.com>
* Makefile.am (libdw.so): No need to link with libeu.a anymore.
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;
else
offset = read_8ubyte_unaligned_inc (dbg, readp);
+ /* Sanity-check the offset. */
+ if (offset + 4 > dbg->sectiondata[IDX_debug_info]->d_size)
+ goto invalid;
+
unsigned int address_size = *readp++;
if (address_size != 4 && address_size != 8)
goto invalid;
offset_size = 4;
new_arange->arange.offset = offset + 3 * offset_size - 4 + 3;
+ /* Sanity-check the data. */
+ if (new_arange->arange.offset
+ >= dbg->sectiondata[IDX_debug_info]->d_size)
+ goto invalid;
+
new_arange->next = arangelist;
arangelist = new_arange;
++narangelist;