https://sourceware.org/bugzilla/show_bug.cgi?id=28305
Bug ID: 28305 Summary: ojbjdump: heap-buffer-overflow in xtensa_insnbuf_from_chars Product: binutils Version: 2.38 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: shaohua.li at inf dot ethz.ch Target Milestone: --- Created attachment 13649 --> https://sourceware.org/bugzilla/attachment.cgi?id=13649&action=edit heap_poc Hi there, I found a heap-buffer-overflow in xtensa_insnbuf_from_chars in xtensa-isa.c:226. - Compiler: clang12 - Platform: Ubuntu 18.04.5 LTS, x86_64 - Reproduce: run `objdump -S heap_poc` AddressSanitizer report: ==2811==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000007d at pc 0x000001ae6740 bp 0x7ffe45a77070 sp 0x7ffe45a77068 READ of size 1 at 0x60200000007d thread T0 #0 0x1ae673f in xtensa_insnbuf_from_chars /binutils_latest/repo/bfd/xtensa-isa.c:226:37 #1 0x1819c75 in elf_xtensa_do_reloc /binutils_latest/repo/bfd/elf32-xtensa.c:1972:3 #2 0x1819218 in bfd_elf_xtensa_reloc /binutils_latest/repo/bfd/elf32-xtensa.c:2235:10 #3 0x1b4bae7 in bfd_perform_relocation /binutils_latest/repo/bfd/reloc.c:711:14 #4 0x1b4fa9f in bfd_generic_get_relocated_section_contents /binutils_latest/repo/bfd/reloc.c:8463:10 #5 0xae85cf in bfd_get_relocated_section_contents /binutils_latest/repo/bfd/bfd.c:2166:10 #6 0xb11ef8 in bfd_simple_get_relocated_section_contents /binutils_latest/repo/bfd/simple.c:298:14 #7 0xcaddac in read_section /binutils_latest/repo/bfd/./dwarf2.c:582:7 #8 0xcaaa47 in _bfd_dwarf2_slurp_debug_info /binutils_latest/repo/bfd/./dwarf2.c:4737:13 #9 0xcaefd1 in _bfd_dwarf2_find_nearest_line /binutils_latest/repo/bfd/./dwarf2.c:4985:9 #10 0xbd33e9 in _bfd_elf_find_nearest_line /binutils_latest/repo/bfd/elf.c:9192:7 #11 0x4e49ea in show_line /binutils_latest/repo/binutils/./objdump.c:1784:9 #12 0x4e0b9f in disassemble_bytes /binutils_latest/repo/binutils/./objdump.c:2770:6 #13 0x4daf10 in disassemble_section /binutils_latest/repo/binutils/./objdump.c:3455:4 #14 0xb100da in bfd_map_over_sections /binutils_latest/repo/bfd/section.c:1383:5 #15 0x4d1ae0 in disassemble_data /binutils_latest/repo/binutils/./objdump.c:3599:3 #16 0x4cda84 in dump_bfd /binutils_latest/repo/binutils/./objdump.c:5006:5 #17 0x4ccb9f in display_object_bfd /binutils_latest/repo/binutils/./objdump.c:5068:7 #18 0x4ccaa9 in display_any_bfd /binutils_latest/repo/binutils/./objdump.c:5158:5 #19 0x4cc65c in display_file /binutils_latest/repo/binutils/./objdump.c:5179:3 #20 0x4cb063 in main /binutils_latest/repo/binutils/./objdump.c:5529:6 #21 0x7f29a2bdf0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #22 0x41c61d in _start (/out_bin/objdump+0x41c61d) 0x60200000007d is located 0 bytes to the right of 13-byte region [0x602000000070,0x60200000007d) allocated by thread T0 here: #0 0x4974dd in malloc (/out_bin/objdump+0x4974dd) #1 0xb044e2 in bfd_malloc /binutils_latest/repo/bfd/libbfd.c:289:9 #2 0xcadd6d in read_section /binutils_latest/repo/bfd/./dwarf2.c:578:31 #3 0xcaaa47 in _bfd_dwarf2_slurp_debug_info /binutils_latest/repo/bfd/./dwarf2.c:4737:13 #4 0xcaefd1 in _bfd_dwarf2_find_nearest_line /binutils_latest/repo/bfd/./dwarf2.c:4985:9 #5 0xbd33e9 in _bfd_elf_find_nearest_line /binutils_latest/repo/bfd/elf.c:9192:7 #6 0x4e49ea in show_line /binutils_latest/repo/binutils/./objdump.c:1784:9 #7 0x4e0b9f in disassemble_bytes /binutils_latest/repo/binutils/./objdump.c:2770:6 #8 0x4daf10 in disassemble_section /binutils_latest/repo/binutils/./objdump.c:3455:4 #9 0xb100da in bfd_map_over_sections /binutils_latest/repo/bfd/section.c:1383:5 #10 0x4d1ae0 in disassemble_data /binutils_latest/repo/binutils/./objdump.c:3599:3 #11 0x4cda84 in dump_bfd /binutils_latest/repo/binutils/./objdump.c:5006:5 #12 0x4ccb9f in display_object_bfd /binutils_latest/repo/binutils/./objdump.c:5068:7 #13 0x4ccaa9 in display_any_bfd /binutils_latest/repo/binutils/./objdump.c:5158:5 #14 0x4cc65c in display_file /binutils_latest/repo/binutils/./objdump.c:5179:3 #15 0x4cb063 in main /binutils_latest/repo/binutils/./objdump.c:5529:6 #16 0x7f29a2bdf0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) SUMMARY: AddressSanitizer: heap-buffer-overflow /binutils_latest/repo/bfd/xtensa-isa.c:226:37 in xtensa_insnbuf_from_chars Shadow bytes around the buggy address: 0x0c047fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c047fff8000: fa fa 00 01 fa fa fd fd fa fa 04 fa fa fa 00[05] 0x0c047fff8010: fa fa 01 fa fa fa 01 fa fa fa 00 fa fa fa 00 fa 0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==2811==ABORTING -- You are receiving this mail because: You are on the CC list for the bug.