[binutils-gdb] Fix a potential illegal memory access in the BFD library when parsing a corrupt DWARF file.

Nick Clifton nickc@sourceware.org
Wed Jan 11 12:13:02 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=11d171f1910b508a81d21faa087ad1af573407d8

commit 11d171f1910b508a81d21faa087ad1af573407d8
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Jan 11 12:12:25 2023 +0000

    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.

Diff:
---
 bfd/ChangeLog | 6 ++++++
 bfd/dwarf2.c  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4219d03d258..2f2ee0d695e 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 bd431805d2a..835851e6afc 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;


More information about the Binutils-cvs mailing list