File libdwfl-sanity-check-partial-core-file-dyn-data-read.patch of Package elfutils.13244
[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#1123685
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
- backported from upstream patch to 0.158
Signed-off-by: Mark Wielaard <mark@klomp.org>
Sgined-off-by: Joao Moreira <jmoreira@suse.de>
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -576,6 +576,9 @@
if (dyn_filesz != 0 && dyn_filesz % dyn_entsize == 0
&& ! read_portion (&dyn_data, &dyn_data_size, dyn_vaddr, dyn_filesz))
{
+ if (dyn_data_size != 0)
+ dyn_filesz = dyn_data_size;
+
union
{
Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)];