diff options
author | Mark Wielaard <mjw@redhat.com> | 2014-12-12 00:22:31 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2014-12-16 11:50:18 +0100 |
commit | f73385ef9582436811e2b84d1ef2d2119f17cc1d (patch) | |
tree | 5ef889ab2bcbf959e792354d6d18e06371f1cf38 /libdw/libdw_findcu.c | |
parent | 4a330f62794abaa3db95a0b447f4c433e4275ce6 (diff) | |
download | elfutils-f73385ef9582436811e2b84d1ef2d2119f17cc1d.tar.gz |
libdw: Make sure end of next cu doesn't overflow section data size.
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>
Diffstat (limited to 'libdw/libdw_findcu.c')
-rw-r--r-- | libdw/libdw_findcu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c index 3c9633e2..c783ff8a 100644 --- a/libdw/libdw_findcu.c +++ b/libdw/libdw_findcu.c @@ -94,6 +94,12 @@ __libdw_intern_next_unit (dbg, debug_types) 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); |