aboutsummaryrefslogtreecommitdiff
path: root/bfd/cpu-mep.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-11-15 22:48:37 +0100
committerTom de Vries <tdevries@suse.de>2024-11-15 22:48:37 +0100
commitf80d7a791b67ab63822c31a6866fce3c2ee04e27 (patch)
tree263ed19fe78cb3c6807fdeb267f84385f9567575 /bfd/cpu-mep.c
parenta7d1f26ec3746758a6b5bfca1b3e514bc73ed0d1 (diff)
downloadbinutils-master.zip
binutils-master.tar.gz
binutils-master.tar.bz2
[gdb/symtab] Fix segfault with dwp fileHEADmaster
Consider the following test-case: ... $ cat test.c int main (void) { return 0; } $ clang -g -gsplit-dwarf test.c -o test $ llvm-dwp -e test -o test.dwp ... This runs into a segmentation fault: ... $ gdb -q -batch test Fatal signal: Segmentation fault ... The segmentation fault happens because in read_dwo_str_index this line sets p to nullptr: ... const gdb_byte *p = reader->dwo_file->sections.str_offsets.buffer; ... while the following code expects it to point to some data. The section we're trying to read is: ... (gdb) p reader->dwo_file->sections.str_offsets $4 = {s = {section = 0xffffcc00a9d0, containing_section = 0xffffcc00a9d0}, buffer = 0x0, size = 28, virtual_offset = 0, readin = false, is_virtual = true} ... At first glance, the section is not readin, but actually it is. This is a virtual section, meaning part of a containing section: ... (gdb) p *reader->dwo_file->sections.str_offsets.s.containing_section $8 = {s = {section = 0xffffcc00cde8, containing_section = 0xffffcc00cde8}, buffer = 0xffffcc009650 "\030", size = 28, virtual_offset = 0, readin = true, is_virtual = false} ... which is readin. Fix this in create_dwp_v2_or_v5_section by initializing the buffer of the virtual section using the buffer of the containing section: ... result.buffer = section->buffer + offset; ... Unfortunately it's difficult to write a test-case for this. We'll have to teach the dwarf assembler to generate dwp files. Tested on aarch64-linux. This is a partial fix for PR symtab/31497. Approved-By: Tom Tromey <tom@tromey.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31497
Diffstat (limited to 'bfd/cpu-mep.c')
0 files changed, 0 insertions, 0 deletions