]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: print_debug_macinfo_section, check cus[0] is not the sentinel.
authorMark Wielaard <mark@klomp.org>
Fri, 29 Mar 2019 09:53:27 +0000 (10:53 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 29 Mar 2019 09:53:27 +0000 (10:53 +0100)
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>
src/ChangeLog
src/readelf.c

index fb1ac096487c6d9d8f4f1e812f8a1625aa570e1b..99ca1b757ccf7cc62b08c365dac884104bcdbef7 100644 (file)
@@ -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>
 
index 33706bdefacf3e2eed1976b313d4945df26d56a6..5654fd1e8139ecc0027a3ff540233fa7704f84e4 100644 (file)
@@ -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)