Signed-off-by: Mark Wielaard <m...@redhat.com>
---
 src/ChangeLog | 5 +++++
 src/readelf.c | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index ccbd6e8..1c3cf2f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
 2014-12-07  Mark Wielaard  <m...@redhat.com>
 
+       * readelf.c (print_debug_line_section): max_ops_per_instr cannot
+       be zero.
+
+2014-12-07  Mark Wielaard  <m...@redhat.com>
+
        * readelf.c (print_ops): Handle zero ref_size for DW_OP_call_ref
        and DW_OP_GNU_implicit_pointer.
 
diff --git a/src/readelf.c b/src/readelf.c
index 881bb45..fa9ede1 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -6506,6 +6506,14 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl 
*ebl, GElf_Ehdr *ehdr,
        op_index = (op_index + op_advance) % max_ops_per_instr;
       }
 
+      if (max_ops_per_instr == 0)
+       {
+         error (0, 0,
+                gettext ("invalid maximum operations per instruction is 
zero"));
+         linep = lineendp;
+         continue;
+       }
+
       while (linep < lineendp)
        {
          size_t offset = linep - (const unsigned char *) data->d_buf;
-- 
1.9.3

Reply via email to