summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-03-29 10:53:27 +0100
committerMark Wielaard <mark@klomp.org>2019-03-29 10:53:27 +0100
commit34ff3ca2e86f8a4915500b92a8e00d6f52aa546c (patch)
tree68d47818bb924c2c05aadaca8569de6d02b1b7ef /src
parente1f353b785b5cdb20d8004b6c4070c3e2a783e8b (diff)
readelf: print_debug_macinfo_section, check cus[0] is not the sentinel.
If there are no CUs at all we can not find any CU DIE file. https://sourceware.org/bugzilla/show_bug.cgi?id=24398 Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/readelf.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fb1ac096..99ca1b75 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,6 +1,11 @@
+2019-03-29 Mark Wielaard <mark@klomp.org>
+
+ * readelf.c (print_debug_macinfo_section): Check cus[0] is not the
+ sentinel.
+
2019-03-27 Mark Wielaard <mark@klomp.org>
- * strip (handle_elf): Assert that symbol section number exists.
+ * strip.c (handle_elf): Assert that symbol section number exists.
2019-01-24 Mark Wielaard <mark@klomp.org>
diff --git a/src/readelf.c b/src/readelf.c
index 33706bde..5654fd1e 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -9688,13 +9688,13 @@ print_debug_macinfo_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
/* Find the CU DIE for this file. */
size_t macoff = readp - (const unsigned char *) data->d_buf;
const char *fname = "???";
- if (macoff >= cus[0].offset)
+ if (macoff >= cus[0].offset && cus[0].offset != data->d_size)
{
while (macoff >= cus[1].offset && cus[1].offset != data->d_size)
++cus;
if (cus[0].files == NULL
- && dwarf_getsrcfiles (&cus[0].die, &cus[0].files, NULL) != 0)
+ && dwarf_getsrcfiles (&cus[0].die, &cus[0].files, NULL) != 0)
cus[0].files = (Dwarf_Files *) -1l;
if (cus[0].files != (Dwarf_Files *) -1l)