readelf: Set begin properly for DW_LLE_GNU_start_end_entry on addrx failure.
authorMark Wielaard <mark@klomp.org>
Tue, 5 Jun 2018 20:50:43 +0000 (22:50 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 8 Jun 2018 10:03:14 +0000 (12:03 +0200)
When printing the GNU DebugFission location entries we want to print the
start idx as begin, if we cannot find the address index.
A copy/paste error set up end instead of begin in that case causing us
to print garbage (in the unlikely event the .debug_addr table wasn't
found for this entry).

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/readelf.c

index 65f9dc7..c0ac418 100644 (file)
@@ -1,5 +1,10 @@
 2018-06-05  Mark Wielaard  <mark@klomp.org>
 
+       * readelf.c (print_debug_loc_section): Set begin to idx when failing
+       to read the start address if DW_LLE_GNU_start_end_entry.
+
+2018-06-05  Mark Wielaard  <mark@klomp.org>
+
        * readelf.c (handle_sysv_hash): Don't leak lengths array when
        detecting an invalid chain.
        (handle_sysv_hash64): Likewise.
index 233312f..68a664d 100644 (file)
@@ -9343,7 +9343,7 @@ print_debug_loc_section (Dwfl_Module *dwflmod,
                goto invalid_data;
              get_uleb128 (idx, locp, locendp);
              if (get_indexed_addr (cu, idx, &begin) != 0)
-               end = idx; /* ... */
+               begin = idx; /* ... */
              if (locp >= locendp)
                goto invalid_data;
              get_uleb128 (idx, locp, locendp);