summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-12-21 23:02:12 +0100
committerMark Wielaard <[email protected]>2015-01-12 22:01:13 +0100
commit8f2f5801a16626b56546f2c95be4c85a59c2e53a (patch)
tree5d2e4f51f5aa1427a456bebc9c1fefe8c18d16e2 /src
parentcda1a31d0e88fb9bea0a14996ac6fa3bd8585648 (diff)
readelf: Don't try to read macinfo cus sentinel or beyond.
https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/readelf.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 00a587cd..7203dd95 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2014-12-20 Mark Wielaard <[email protected]>
+ * readelf.c (print_debug_macinfo_section): Mark cus sentinel files
+ as -1 non-existent. Check macoff against sentinel cus.
+
+2014-12-20 Mark Wielaard <[email protected]>
+
* readelf.c (print_debug_exception_table): Add max_action overflow
check. Check action_table_end before reading slib128. Check
max_ar_filter underflow.
diff --git a/src/readelf.c b/src/readelf.c
index a05b2382..237975f9 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -7061,6 +7061,7 @@ print_debug_macinfo_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
* sizeof (*cus));
/* Add sentinel. */
cus[nculist].offset = data->d_size;
+ cus[nculist].files = (Dwarf_Files *) -1l;
if (nculist > 0)
{
for (size_t cnt = nculist - 1; culist != NULL; --cnt)
@@ -7136,7 +7137,7 @@ print_debug_macinfo_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
const char *fname = "???";
if (macoff >= cus[0].offset)
{
- while (macoff >= cus[1].offset)
+ while (macoff >= cus[1].offset && cus[1].offset != data->d_size)
++cus;
if (cus[0].files == NULL