diff options
author | Nick Clifton <nickc@redhat.com> | 2020-05-04 10:19:38 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-05-04 10:19:38 +0100 |
commit | 4706679daca21b5d637afaf5b55858b26f0f8c16 (patch) | |
tree | 8950f5eb3edfacd8a64ff517515f9144daf5f624 /gas/dwarf2dbg.c | |
parent | 6015a0674901be2c3fd24867e1a610d2abf8c1a0 (diff) | |
download | gdb-4706679daca21b5d637afaf5b55858b26f0f8c16.zip gdb-4706679daca21b5d637afaf5b55858b26f0f8c16.tar.gz gdb-4706679daca21b5d637afaf5b55858b26f0f8c16.tar.bz2 |
Fix an illegal memory access in the assembler when generating a DWARF5 file/directory table with no entries.
PR 25917
* dwarf2dbg.c (out_dir_and_file_list): Check for the directory
table's existence before looking at its entries.
* testsuite/gas/elf/pr25917.s: New test source file.
* testsuite/gas/elf/pr25917.d: New test driver.
* testsuite/gas/elf/elf.exp (run_elf_list_test): Run the new test.
Diffstat (limited to 'gas/dwarf2dbg.c')
-rw-r--r-- | gas/dwarf2dbg.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 9fdb34f..213f382 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1995,7 +1995,7 @@ out_dir_and_file_list (void) /* Emit directory list. */ if (DWARF2_LINE_VERSION >= 5) { - if (dirs[0] == NULL) + if (dirs == NULL || dirs[0] == NULL) dir = remap_debug_filename ("."); else dir = remap_debug_filename (dirs[0]); |