An invalid or trucated debug info/type section could cause the cu endp
to point beyond the end of section data.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
+2014-12-11 Mark Wielaard <mjw@redhat.com>
+
+ * libdw_findcu.c (__libdw_intern_next_unit): Sanity check offset.
+
2014-12-13 Mark Wielaard <mjw@redhat.com>
* dwarf_getaranges.c (compare_aranges): Make sure Dwarf_Addr
return NULL;
}
+ /* Invalid or truncated debug section data? */
+ Elf_Data *data = dbg->sectiondata[debug_types
+ ? IDX_debug_types : IDX_debug_info];
+ if (unlikely (*offsetp > data->d_size))
+ *offsetp = data->d_size;
+
/* Create an entry for this CU. */
struct Dwarf_CU *newp = libdw_typed_alloc (dbg, struct Dwarf_CU);