https://sourceware.org/bugzilla/show_bug.cgi?id=21156
Bug ID: 21156 Summary: readefl segfault - invalid read of size 4 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 9823 --> https://sourceware.org/bugzilla/attachment.cgi?id=9823&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 checked out from main repository at git://sourceware.org/git/binutils-gdb.git. Its commit is 61697d017e114d7667fbb340fb73f8184d48ee5a (Tue Feb 14 00:00:30 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_2 readelf -w bug_2 Valgrind says: ==1379== Invalid read of size 4 ==1379== at 0x4035F3: find_section_in_set (readelf.c:679) ==1379== by 0x422724: load_debug_section (readelf.c:13043) ==1379== by 0x435D25: load_debug_info (dwarf.c:2720) ==1379== by 0x437D1F: display_debug_aranges (dwarf.c:4933) ==1379== by 0x423A0A: display_debug_section (readelf.c:13132) ==1379== by 0x423A0A: process_section_contents (readelf.c:13207) ==1379== by 0x423A0A: process_object (readelf.c:16899) ==1379== by 0x402111: process_file (readelf.c:17273) ==1379== by 0x402111: main (readelf.c:17344) ==1379== Address 0x5205e00 is 0 bytes inside a block of size 60 free'd ==1379== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==1379== by 0x4E6B587: _nl_make_l10nflist (l10nflist.c:256) ==1379== by 0x4E68FD9: _nl_find_domain (finddomain.c:86) ==1379== by 0x4E6881D: __dcigettext (dcigettext.c:640) ==1379== by 0x42872A: get_FORM_name (dwarf.c:864) ==1379== by 0x428D78: display_debug_abbrev (dwarf.c:4385) ==1379== by 0x423A0A: display_debug_section (readelf.c:13132) ==1379== by 0x423A0A: process_section_contents (readelf.c:13207) ==1379== by 0x423A0A: process_object (readelf.c:16899) ==1379== by 0x402111: process_file (readelf.c:17273) ==1379== by 0x402111: main (readelf.c:17344) ==1379== ==1379== ==1379== Process terminating with default action of signal 11 (SIGSEGV) ==1379== Access not within mapped region at address 0x4CE5202E80 ==1379== at 0x4035F3: find_section_in_set (readelf.c:679) ==1379== by 0x422724: load_debug_section (readelf.c:13043) ==1379== by 0x435D25: load_debug_info (dwarf.c:2720) ==1379== by 0x437D1F: display_debug_aranges (dwarf.c:4933) ==1379== by 0x423A0A: display_debug_section (readelf.c:13132) ==1379== by 0x423A0A: process_section_contents (readelf.c:13207) ==1379== by 0x423A0A: process_object (readelf.c:16899) ==1379== by 0x402111: process_file (readelf.c:17273) ==1379== by 0x402111: main (readelf.c:17344) ASAN says: ==112697==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61c000012800 at pc 0x47fd80 bp 0x7ffd87842e70 sp 0x7ffd87842e68 READ of size 4 at 0x61c000012800 thread T0 #0 0x47fd7f in find_section_in_set /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:679 #1 0x47edc0 in load_debug_section /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:13043 #2 0x6ad616 in load_debug_info /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/dwarf.c:2720 #3 0x647cb4 in display_debug_aranges /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/dwarf.c:4933 #4 0x5667ca in display_debug_section /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:13132 #5 0x4e1a7f in process_section_contents /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:13207 #6 0x48d720 in process_object /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:16899 #7 0x488475 in process_file /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:17273 #8 0x4856d3 in main /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:17344 #9 0x7f1697af2f44 (/lib/x86_64-linux-gnu/libc.so.6+0x21f44) #10 0x47ddfc in _start (/home/ubuntu/thesis/subjects/binutils-gdb-nick/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