diff options
author | Tom de Vries <tdevries@suse.de> | 2023-04-17 18:09:32 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-04-17 18:09:32 +0200 |
commit | fb12bc1e8e7c5246e4eabcebdb4644c43bc7e6b9 (patch) | |
tree | 03eec95cd3d3f2ec47719832116c9932a48bf613 /bfd | |
parent | b29f2fda4f189a008f5f2017d403976c988ad63e (diff) | |
download | binutils-fb12bc1e8e7c5246e4eabcebdb4644c43bc7e6b9.zip binutils-fb12bc1e8e7c5246e4eabcebdb4644c43bc7e6b9.tar.gz binutils-fb12bc1e8e7c5246e4eabcebdb4644c43bc7e6b9.tar.bz2 |
[gdb/symtab] Handle empty file name in .debug_line section
With DWARF 5, it's possible to produce an empty file name in the File Name
Table of the .debug_line section:
...
The File Name Table (offset 0x112, lines 1, columns 2):
Entry Dir Name
0 1 (indirect line string, offset: 0x2d):
...
Currently, when gdb reads an exec containing such debug info, it segfaults:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x000000000072cd38 in dwarf2_start_subfile (cu=0x2badc50, fe=..., lh=...) at \
gdb/dwarf2/read.c:18716
18716 if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
...
because read_direct_string transforms "" into a nullptr, and we end up
dereferencing the nullptr.
Note that the behaviour of read_direct_string has been present since repo
creation.
Fix this in read_formatted_entries, by transforming nullptr filenames in to ""
filenames.
Tested on x86_64-linux.
Reviewed-By: Tom Tromey <tom@tromey.com>
PR symtab/30357
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30357
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions