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>
diff --git a/src/ChangeLog b/src/ChangeLog
index fb1ac09..99ca1b7 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 33706bd..5654fd1 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -9688,13 +9688,13 @@
 	  /* 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)