https://sourceware.org/bugzilla/show_bug.cgi?id=21141
Bug ID: 21141 Summary: readelf segfault - invalid write in elfcomm.c Product: binutils Version: 2.29 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: thuanpv at comp dot nus.edu.sg Target Milestone: --- Created attachment 9808 --> https://sourceware.org/bugzilla/attachment.cgi?id=9808&action=edit Crashing input Dear all, This bug was found with AFLGo, a directed version of AFL/AFLFast. Thanks also to Marcel Böhme. This bug was found on Ubuntu 14.04 64-bit & binutils was checkout from main repository at git://sourceware.org/git/binutils-gdb.git. Its commit is 53f7e8ea7fad1fcff1b58f4cbd74e192e0bcbc1d (Fri Feb 10 00:00:16 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_7 readelf -w bug_7 Valgrind says: ==128187== Invalid write of size 1 ==128187== at 0x438C87: byte_put_little_endian (elfcomm.c:75) ==128187== by 0x408B97: target_specific_reloc_handling (readelf.c:11640) ==128187== by 0x408B97: apply_relocations (readelf.c:12343) ==128187== by 0x40B133: load_specific_debug_section (readelf.c:12905) ==128187== by 0x42384B: display_debug_section (readelf.c:13009) ==128187== by 0x42384B: process_section_contents (readelf.c:13091) ==128187== by 0x42384B: process_object (readelf.c:16780) ==128187== by 0x402111: process_file (readelf.c:17154) ==128187== by 0x402111: main (readelf.c:17225) ==128187== Address 0x6203611 is not stack'd, malloc'd or (recently) free'd ==128187== ==128187== ==128187== Process terminating with default action of signal 11 (SIGSEGV) ==128187== Access not within mapped region at address 0x6203611 ==128187== at 0x438C87: byte_put_little_endian (elfcomm.c:75) ==128187== by 0x408B97: target_specific_reloc_handling (readelf.c:11640) ==128187== by 0x408B97: apply_relocations (readelf.c:12343) ==128187== by 0x40B133: load_specific_debug_section (readelf.c:12905) ==128187== by 0x42384B: display_debug_section (readelf.c:13009) ==128187== by 0x42384B: process_section_contents (readelf.c:13091) ==128187== by 0x42384B: process_object (readelf.c:16780) ==128187== by 0x402111: process_file (readelf.c:17154) ==128187== by 0x402111: main (readelf.c:17225) ASAN says: ==126476==ERROR: AddressSanitizer: SEGV on unknown address 0x611001009481 (pc 0x000000722aa9 sp 0x7fff64ffa960 bp 0x7fff64ffac10 T0) #0 0x722aa8 in byte_put_little_endian /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/elfcomm.c:75 #1 0x54acfa in target_specific_reloc_handling /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:11640 #2 0x52e6dc in apply_relocations /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:12343 #3 0x4846b5 in load_specific_debug_section /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:12905 #4 0x564b4c in display_debug_section /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:13009 #5 0x4e194f in process_section_contents /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:13091 #6 0x48d610 in process_object /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:16780 #7 0x488365 in process_file /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:17154 #8 0x4855c3 in main /home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:17225 #9 0x7f7ae9a5df44 (/lib/x86_64-linux-gnu/libc.so.6+0x21f44) #10 0x47ddfc in _start (/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/readelf+0x47ddfc) -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils