diff options
author | Mark Wielaard <mark@klomp.org> | 2019-03-27 22:32:21 +0100 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2019-03-27 22:39:39 +0100 |
commit | e1f353b785b5cdb20d8004b6c4070c3e2a783e8b (patch) | |
tree | 1465a1ffac21b0ba7377bde9ff5057cb09514e1d /libdwfl | |
parent | f03ac75239e0981deaf4aa18f66f423bcc5ce051 (diff) | |
download | elfutils-e1f353b785b5cdb20d8004b6c4070c3e2a783e8b.tar.gz |
libdwfl: Sanity check partial core file phdrs data read.
When reading the phdrs data from the core file check if we got everything,
or just part of the data.
https://sourceware.org/bugzilla/show_bug.cgi?id=24387
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdwfl')
-rw-r--r-- | libdwfl/ChangeLog | 5 | ||||
-rw-r--r-- | libdwfl/dwfl_segment_report_module.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 95dc426b..1da888f6 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2019-03-27 Mark Wielaard <mark@klomp.org> + + * dwfl_segment_report_module.c (dwfl_segment_report_module): Check + ph_buffer_size vs xlatefrom.d_size after read_portion call. + 2019-02-24 Mark Wielaard <mark@klomp.org> * linux-kernel-modules.c (intuit_kernel_bounds): Init *notes before diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index f6ad39b3..76ba1506 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -412,6 +412,12 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, start + phoff, xlatefrom.d_size)) return finish (); + /* ph_buffer_size will be zero if we got everything from the initial + buffer, otherwise it will be the size of the new buffer that + could be read. */ + if (ph_buffer_size != 0) + xlatefrom.d_size = ph_buffer_size; + xlatefrom.d_buf = ph_buffer; bool class32 = ei_class == ELFCLASS32; |