Fix illegal memory access parsing corrupt DWARF information.
authorNick Clifton <nickc@redhat.com>
Fri, 23 Dec 2022 13:02:04 +0000 (13:02 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 23 Dec 2022 13:02:42 +0000 (13:02 +0000)
PR 29936
* dwarf2.c (concat_filename): Fix check for a directory index off
the end of the directory table.

bfd/ChangeLog
bfd/dwarf2.c

index 81227dc9ce84c13ef9821c2042d3b0f31552ae93..49e18c98d59d949e2baf44bb05de6a109938d39e 100644 (file)
@@ -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.
index b608afbc0cf260e98e2f87ab6d55c935937b2810..88335cb4fb0dddc3b1ca8a1d76c32b88ff85aa89 100644 (file)
@@ -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)
        {