The vendor array should have room for all vendor opcode, including
DW_MACRO_hi_user if used.

Signed-off-by: Mark Wielaard <m...@klomp.org>
---
 src/ChangeLog | 5 +++++
 src/readelf.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index cc12d83..c376a5b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-05  Mark Wielaard  <m...@klomp.org>
+
+       * readelf.c (print_debug_macro_section): Extend vendor array by one
+       to include max DW_MACRO_hi_user opcode.
+
 2018-05-31  Mark Wielaard  <m...@klomp.org>
 
        * readelf.c (print_debug_units): Print the dwo name and id when
diff --git a/src/readelf.c b/src/readelf.c
index 0725313..6c17788 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -9736,7 +9736,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)
        {
-- 
1.8.3.1

Reply via email to