[binutils-gdb] Fix illegal memory access parsing corrupt DWARF information.

Nick Clifton nickc@sourceware.org
Fri Dec 23 13:02:49 GMT 2022


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

commit 8af23b30edbaedf009bc9b243cd4dfa10ae1ac09
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Dec 23 13:02:04 2022 +0000

    Fix illegal memory access parsing corrupt DWARF information.
    
            PR 29936
            * dwarf2.c (concat_filename): Fix check for a directory index off
            the end of the directory table.

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

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 81227dc9ce8..49e18c98d59 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2022-12-23  Nick Clifton  <nickc@redhat.com>
+
+	PR 29936
+	* dwarf2.c (concat_filename): Fix check for a directory index off
+	the end of the directory table.
+
 2022-12-21  Nick Clifton  <nickc@redhat.com>
 
 	* po/ro.po: Updated Romanian translation.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index b608afbc0cf..88335cb4fb0 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2047,7 +2047,8 @@ concat_filename (struct line_info_table *table, unsigned int file)
 
       if (table->files[file].dir
 	  /* PR 17512: file: 0317e960.  */
-	  && table->files[file].dir <= table->num_dirs
+	  && table->files[file].dir
+	  <= (table->use_dir_and_file_0 ? table->num_dirs - 1 : table->num_dirs)
 	  /* PR 17512: file: 7f3d2e4b.  */
 	  && table->dirs != NULL)
 	{


More information about the Binutils-cvs mailing list