aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-01-11 12:12:25 +0000
committerNick Clifton <nickc@redhat.com>2023-01-11 12:12:25 +0000
commit11d171f1910b508a81d21faa087ad1af573407d8 (patch)
tree0970c1a1c70a8bfef5acf93cd6733d07705fe9a0
parentf1e19328594fb0cc35dc7d6573a7a36f5ab9ecc4 (diff)
downloadgdb-11d171f1910b508a81d21faa087ad1af573407d8.zip
gdb-11d171f1910b508a81d21faa087ad1af573407d8.tar.gz
gdb-11d171f1910b508a81d21faa087ad1af573407d8.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.
-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 4219d03..2f2ee0d 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 bd43180..835851e 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1420,7 +1420,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;