From f0c5ef85bbea093af42c2b95a1f349ebef63de0d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 7 Dec 2014 23:40:12 +0100 Subject: [PATCH] readelf: maximum operations per instruction cannot be zero in .debug_line. Signed-off-by: Mark Wielaard --- 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 + * readelf.c (print_debug_line_section): max_ops_per_instr cannot + be zero. + +2014-12-07 Mark Wielaard + * 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; -- 2.7.4