aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-10-05 11:25:26 +1030
committerAlan Modra <amodra@gmail.com>2022-10-05 14:53:41 +1030
commit306253b2cfa297c1eb0d30852bdcf96375db24e2 (patch)
tree6c66f35fb031abbe46e57c4668f8df6eddcdc42f /binutils
parent011a13613403c42717c623b0c5fc1e69de9f65b5 (diff)
downloadgdb-306253b2cfa297c1eb0d30852bdcf96375db24e2.zip
gdb-306253b2cfa297c1eb0d30852bdcf96375db24e2.tar.gz
gdb-306253b2cfa297c1eb0d30852bdcf96375db24e2.tar.bz2
PR29647, objdump -S looping
Fuzzed input with this in .debug_line [0x0000003b] Special opcode 115: advance Address by 8 to 0x401180 and Line by -2 to -1 PR 29647 * objdump.c (print_line): Don't decrement line number here.. (dump_lines): ..do so here instead, ensuring loop terminates.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/objdump.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 6610906..f7b4695 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -2069,7 +2069,6 @@ print_line (struct print_file_list *p, unsigned int linenum)
const char *l;
size_t len;
- --linenum;
if (linenum >= p->maxline)
return;
l = p->linemap [linenum];
@@ -2088,7 +2087,9 @@ dump_lines (struct print_file_list *p, unsigned int start, unsigned int end)
{
if (p->map == NULL)
return;
- while (start <= end)
+ if (start != 0)
+ --start;
+ while (start < end)
{
print_line (p, start);
start++;