aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-01-11 12:13:46 +0000
committerNick Clifton <nickc@redhat.com>2023-01-11 12:13:46 +0000
commit3e307d538c351aa9327cbad672c884059ecc20dd (patch)
tree2a84c52af268d3173bf920fee95ea92ebdbb9151 /bfd
parentad2021a0f761e23576820aca50a7ac10d7f40bed (diff)
downloadgdb-3e307d538c351aa9327cbad672c884059ecc20dd.zip
gdb-3e307d538c351aa9327cbad672c884059ecc20dd.tar.gz
gdb-3e307d538c351aa9327cbad672c884059ecc20dd.tar.bz2
Fix a potential illegal memory access in the BFD library when parsing a corrupt DWARF file.
PR 29988 * dwarf2.c (read_indexed_address): Fix check for an out of range offset.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/dwarf2.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f5b5b66..c2a8dc6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2023-01-11 Nick Clifton <nickc@redhat.com>
+
+ PR 29988
+ * dwarf2.c (read_indexed_address): Fix check for an out of range
+ offset.
+
2023-01-06 Nick Clifton <nickc@redhat.com>
* po/ru.po: Updated Russian translation.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 6eb6e04..4ec0053 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
offset += unit->dwarf_addr_offset;
if (offset < unit->dwarf_addr_offset
|| offset > file->dwarf_addr_size
- || file->dwarf_addr_size - offset < unit->offset_size)
+ || file->dwarf_addr_size - offset < unit->addr_size)
return 0;
info_ptr = file->dwarf_addr_buffer + offset;