[Bug symtab/34481] New: bfd_section_size_insane enforces arbitrary limit on decompressed size of .dwo files

"ryan.berryhill at gmail dot com via Gdb-prs" <[email protected]>
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=34481

            Bug ID: 34481
           Summary: bfd_section_size_insane enforces arbitrary limit on
                    decompressed size of .dwo files
           Product: gdb
           Version: 17.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: ryan.berryhill at gmail dot com
  Target Milestone: ---

Created attachment 16905
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16905&action=edit
C reproducer

In bfd_section_size_insane, there's an arbitrary limit that a section's
decompressed size cannot exceed 10x the size of the file it belongs to. When
debugging a program with compressed split debug symbols, it's possible to
exceed this limit. gdb will fail to load the symbols and produce errors like
those below.

The attached C program can reproduce the bug. Building and debugging it like so
(using main expand-symtabs to illustrate the problem):

# Build the reproducer (I used gcc 11.4.0 but any version supporting the
options used should work)
gcc -g -gsplit-dwarf -gz -o repro repro.c
# Run maint expand-symtabs to trigger the bug (I used gdb 17.1 but the issue
exists in at least 17.2 and HEAD)
gdb -nx -batch -ex "maint expand-symtabs" ./repro
During symbol reading: BFD: error:
/home/ubuntu/src/gdb-bug/repro.dwo(.debug_str.dwo) is too large (0x1a0b4 bytes)
During symbol reading: Can't read data for section '.debug_str.dwo' in file
'/home/ubuntu/src/gdb-bug/repro.dwo'
DW_FORM_GNU_str_index or DW_FORM_strx used without .debug_str.dwo section in CU
at offset 0x0 [in module /home/ubuntu/src/gdb-bug/repro]
DW_FORM_GNU_str_index or DW_FORM_strx used without .debug_str.dwo section in CU
at offset 0x0 [in module /home/ubuntu/src/gdb-bug/repro]

While this is a contrived reproducer, I'm hitting this bug in a real C++
codebase.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.