Bug 21410 - global-buffer-overflow in objcopy
Summary: global-buffer-overflow in objcopy
Status: RESOLVED DUPLICATE of bug 21412
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.28
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-22 04:39 UTC by Manh-Dung Nguyen
Modified: 2017-04-23 02:44 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Bug triggering input (454 bytes, application/x-object)
2017-04-22 04:39 UTC, Manh-Dung Nguyen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Manh-Dung Nguyen 2017-04-22 04:39:50 UTC
Created attachment 10007 [details]
Bug triggering input

Dear All,

This bug was found with AFLGo, a directed version of AFL/AFLFast. Thanks also to Marcel Böhme and Van-Thuan Pham.

This bug was found on Ubuntu 14.04 64-bit & binutils was checked out from main repository at git://sourceware.org/git/binutils-gdb.git. Its commit is a6c21d4a553de184562fd8409a5bcd3f2cc2561a (Wed Apr 19 13:16:05 2017).

binutils was built with ASAN using gcc-6.2 and clang-3.4. The configure command was:

CC=clang CFLAGS="-DFORTIFY_SOURCE=2 -fstack-protector-all -fsanitize=undefined,address -fno-omit-frame-pointer -g -Wno-error" ../configure --disable-shared --disable-gdb --disable-libdecnumber --disable-readline --disable-sim

To reproduce:
Download the attached file - bug_8
objcopy --compress-debug-sections bug_8

ASAN says:
==148402==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000001a69aa5 at pc 0x00000044f150 bp 0x7ffec8592db0 sp 0x7ffec8592570
READ of size 1 at 0x000001a69aa5 thread T0
    #0 0x44f14f in __interceptor_strcmp (/home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/binutils/objcopy+0x44f14f)
    #1 0xb11a0a in _bfd_elf_get_reloc_section /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/bfd/../../bfd/elf.c:3568:10
    #2 0xb3e092 in assign_section_numbers /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/bfd/../../bfd/elf.c:3844:8
    #3 0xb15eb0 in _bfd_elf_compute_section_file_positions /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/bfd/../../bfd/elf.c:4184:8
    #4 0xbad0f6 in _bfd_elf_set_section_contents /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/bfd/../../bfd/elf.c:8748:12
    #5 0x86b5db in bfd_set_section_contents /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/bfd/../../bfd/section.c:1533:7
    #6 0x5267e5 in copy_section /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/binutils/../../binutils/objcopy.c:3887:12
    #7 0x869135 in bfd_map_over_sections /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/bfd/../../bfd/section.c:1395:5
    #8 0x502117 in copy_object /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/binutils/../../binutils/objcopy.c:2858:3
    #9 0x4ebe2c in copy_file /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/binutils/../../binutils/objcopy.c:3333:13
    #10 0x4d6716 in copy_main /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/binutils/../../binutils/objcopy.c:5266:3
    #11 0x4cac8a in main /home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/binutils/../../binutils/objcopy.c:5367:5
    #12 0x7fa14cf70f44 in __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:287
    #13 0x4ca31c in _start (/home/ubuntu/binutils-analysis/binutils-gdb/obj-asan/binutils/objcopy+0x4ca31c)
Comment 1 Alan Modra 2017-04-23 02:44:43 UTC
Dup

*** This bug has been marked as a duplicate of bug 21412 ***