https://sourceware.org/bugzilla/show_bug.cgi?id=28423
Bug ID: 28423 Summary: use-after-free in objdump at disassemble_bytes objdump.c:3059 Product: binutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: irfanariq at kaist dot ac.kr Target Milestone: --- Created attachment 13706 --> https://sourceware.org/bugzilla/attachment.cgi?id=13706&action=edit poc and full stack trace Hello, We are currently working on fuzz testing feature, and we found a **use-after-free** on `objdump`. The stack traces are as follow: ```st ==2689==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000000190 at pc 0x560e3bcdef38 bp 0x7ffe07f66680 sp 0x7ffe07f66670 READ of size 8 at 0x602000000190 thread T0 #0 0x560e3bcdef37 in disassemble_bytes objdump.c:3059 #1 0x560e3bce1342 in disassemble_section objdump.c:3455 #2 0x560e3c1ac3c0 in bfd_map_over_sections .../binutils-git/bfd/section.c:1383 #3 0x560e3bce2293 in disassemble_data objdump.c:3599 #4 0x560e3bce96cc in dump_bfd objdump.c:5006 #5 0x560e3bce9994 in display_object_bfd objdump.c:5068 #6 0x560e3bce9d2f in display_any_bfd objdump.c:5158 #7 0x560e3bce9cd9 in display_any_bfd objdump.c:5139 #8 0x560e3bce9da6 in display_file objdump.c:5179 #9 0x560e3bceb15a in main objdump.c:5529 ``` The full stack trace is attached. **Step to reproduce** We configured `objdump` using `CFLAGS="-g -O0 -fsanitize=address" ./configure --prefix=$(pwd)/ --disable-shared --enable-targets=all` and build it using `make -j 10`, and run it with: ``` ./objdump data16 -marm i8086 64 -Ttext --headers <attached file> ppcps --debugging --wide --demangle 440 --dwarf --file-offsets --line-numbers --disassemble nm -d -Wa ``` The input file is attached. **Environment** - OS: Ubuntu 18.04.5 LTS - GCC version: gcc 7.5.0 - binutils version: commit (98ca73a) of master branch on sourceware git ([link](https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=98ca73afe51e1e921915c37f242c88d4d445841c)) Thank you. -- You are receiving this mail because: You are on the CC list for the bug.