From 5250d2f0a536276cbc8735e53ae70425780b991f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 15 May 2021 15:15:47 +0930 Subject: [PATCH] display_debug_str_offsets * dwarf.c (display_debug_str_offsets): Constrain reads to length given in header. --- binutils/ChangeLog | 5 +++++ binutils/dwarf.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6d36f58a9c9..670ab977044 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2021-05-15 Alan Modra + + * dwarf.c (display_debug_str_offsets): Constrain reads to length + given in header. + 2021-05-15 Alan Modra * dwarf.c (display_debug_aranges): Delete initial_length_size. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index cd76f3f5e83..a0b84fc8d85 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -7480,12 +7480,12 @@ display_debug_str_offsets (struct dwarf_section *section, } int version; - SAFE_BYTE_GET_AND_INC (version, curr, 2, end); + SAFE_BYTE_GET_AND_INC (version, curr, 2, entries_end); if (version != 5) warn (_("Unexpected version number in str_offset header: %#x\n"), version); int padding; - SAFE_BYTE_GET_AND_INC (padding, curr, 2, end); + SAFE_BYTE_GET_AND_INC (padding, curr, 2, entries_end); if (padding != 0) warn (_("Unexpected value in str_offset header's padding field: %#x\n"), padding); -- 2.30.2