From 669f463dbc700ab2694c960bb3e3f1083323f500 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 15 May 2021 15:17:16 +0930 Subject: [PATCH] display_debug_rnglists_list * dwarf.c (display_debug_rnglists_list): Avoid pointer UB. --- binutils/ChangeLog | 4 ++++ binutils/dwarf.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 670ab977044..db5ed0f4b54 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2021-05-15 Alan Modra + + * dwarf.c (display_debug_rnglists_list): Avoid pointer UB. + 2021-05-15 Alan Modra * dwarf.c (display_debug_str_offsets): Constrain reads to length diff --git a/binutils/dwarf.c b/binutils/dwarf.c index a0b84fc8d85..c4b6edf8721 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -7603,7 +7603,7 @@ display_debug_rnglists_list (unsigned char *start, unsigned char *finish, /* Initialize it due to a false compiler warning. */ dwarf_vma begin = -1, length, end = -1; - if (start + 1 > finish) + if (start >= finish) { warn (_("Range list starting at offset 0x%lx is not terminated.\n"), offset); -- 2.30.2