display_debug_str_offsets

* dwarf.c (display_debug_str_offsets): Constrain reads to length
	given in header.
This commit is contained in:
Alan Modra
2021-05-15 15:15:47 +09:30
parent 6ca0735017
commit 5250d2f0a5
2 changed files with 7 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
2021-05-15 Alan Modra <amodra@gmail.com>
* dwarf.c (display_debug_str_offsets): Constrain reads to length
given in header.
2021-05-15 Alan Modra <amodra@gmail.com>
* dwarf.c (display_debug_aranges): Delete initial_length_size.

View File

@@ -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);