Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
elfutils.14006
libdwfl-sanity-check-partial-core-file-data-rea...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libdwfl-sanity-check-partial-core-file-data-reads.patch of Package elfutils.14006
[PATCH] libdwfl: Sanity check partial core file data reads. From: Mark Wielaard <mark at klomp dot org> To: elfutils-devel at sourceware dot org Cc: Mark Wielaard <mark at klomp dot org> Date: Sun, 14 Oct 2018 16:48:30 +0200 Subject: [PATCH] libdwfl: Sanity check partial core file data reads. Reference: bnc#1111973 There were two issues when reading note data from a core file. We didn't check if the data we already had in a buffer was big enough. And if we did get the data, we should check if we got everything, or just a part of the data. https://sourceware.org/bugzilla/show_bug.cgi?id=23752 elfutils packaging edits: - changelog hunk removed from original patch to avoid conflict Signed-off-by: Mark Wielaard <mark@klomp.org> --- libdwfl/ChangeLog | 7 +++++++ libdwfl/dwfl_segment_report_module.c | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 36e5c82..8749884 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -301,7 +301,10 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, inline bool read_portion (void **data, size_t *data_size, GElf_Addr vaddr, size_t filesz) { - if (vaddr - start + filesz > buffer_available + /* Check whether we will have to read the segment data, or if it + can be returned from the existing buffer. */ + if (filesz > buffer_available + || vaddr - start > buffer_available - filesz /* If we're in string mode, then don't consider the buffer we have sufficient unless it contains the terminator of the string. */ || (filesz == 0 && memchr (vaddr - start + buffer, '\0', @@ -459,6 +462,12 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, if (read_portion (&data, &data_size, vaddr, filesz)) return; + /* data_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 (data_size != 0) + filesz = data_size; + assert (sizeof (Elf32_Nhdr) == sizeof (Elf64_Nhdr)); void *notes; -- 1.8.3.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor