Created attachment 13831 [details] poc_clang-O0 Hi there, I crashed `objdump -S -D` when I compile binutils with `clang-13 -O0`. For the provided poc, if I compile with other opt flags, e.g., `clang-13 -O2`, `objdump -S -D` would not crash. - Compiler: clang-13 -O0 - Platform: Ubuntu 20.04.4 LTS, x86_64 - Reproduce: run `objdump -S -D poc_clang-O0` - Raw output: ../bin/objdump-clang13-O0: Warning: Corrupt unit length (got 0x656c6966 expected at most 0x12) in section .debug_info bugs/diff_5: file format elf64-x86-64 Disassembly of section .debug_str: 0000000000000000 <string1>: ../bin/objdump-clang13-O0: BFD (GNU Binutils) 2.37.50.20211202 assertion fail ./dwarf2.c:4296 ../bin/objdump-clang13-O0: DWARF error: info pointer extends beyond end of attributes ../bin/objdump-clang13-O0: DWARF error: info pointer extends beyond end of attributes Segmentation fault (core dumped)
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b243230f64fb4db9a16ef88ec5bd3e3f48f1fe41 commit b243230f64fb4db9a16ef88ec5bd3e3f48f1fe41 Author: Alan Modra <amodra@gmail.com> Date: Fri Dec 10 08:27:58 2021 +1030 PR28674, objdump crash Not returning an error indication here leaves the attribute uninitialised, which then leads to intemperate behaviour. PR 28674 * dwarf2.c (read_attribute_value): Return NULL on trying to read past end of attributes.
Fixed
*** Bug 28662 has been marked as a duplicate of this bug. ***
*** Bug 28652 has been marked as a duplicate of this bug. ***