readelf: Make room for DW_MACRO_hi_user opcode if used.
authorMark Wielaard <mark@klomp.org>
Tue, 5 Jun 2018 19:04:05 +0000 (21:04 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 8 Jun 2018 10:03:14 +0000 (12:03 +0200)
The vendor array should have room for all vendor opcode, including
DW_MACRO_hi_user if used.

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

index d6fc919..83c8532 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-05  Mark Wielaard  <mark@klomp.org>
+
+       * readelf.c (print_debug_macro_section): Extend vendor array by one
+       to include max DW_MACRO_hi_user opcode.
+
 2018-06-07  Mark Wielaard  <mark@klomp.org>
 
        * readelf.c (main): Lookup "no" for no_str.
index 6ac4511..11a9b0e 100644 (file)
@@ -9721,7 +9721,7 @@ print_debug_macro_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
                                                               ? cu->die.cu
                                                               : NULL));
 
-      const unsigned char *vendor[DW_MACRO_hi_user - DW_MACRO_lo_user];
+      const unsigned char *vendor[DW_MACRO_hi_user - DW_MACRO_lo_user + 1];
       memset (vendor, 0, sizeof vendor);
       if (flag & 0x04)
        {