aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2022-12-23 13:02:04 +0000
committerNick Clifton <nickc@redhat.com>2022-12-23 13:02:42 +0000
commit8af23b30edbaedf009bc9b243cd4dfa10ae1ac09 (patch)
treee754087159e116506e93ee151c5c99987b031fab /bfd/dwarf2.c
parent8fbad19958c9b9c06a710bf7d6589d52f1ed8a64 (diff)
downloadgdb-8af23b30edbaedf009bc9b243cd4dfa10ae1ac09.zip
gdb-8af23b30edbaedf009bc9b243cd4dfa10ae1ac09.tar.gz
gdb-8af23b30edbaedf009bc9b243cd4dfa10ae1ac09.tar.bz2
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.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index b608afb..88335cb 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)
{