https://sourceware.org/bugzilla/show_bug.cgi?id=21159
Bug ID: 21159 Summary: readelf of-by-one -- seems to be related to PR 21135 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 9826 --> https://sourceware.org/bugzilla/attachment.cgi?id=9826&action=edit Bug triggering 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_3 readelf -zR8 bug_3 Valgrind says: ==43329== Invalid read of size 1 ==43329== at 0x41E760: dump_section_as_bytes (readelf.c:12894) ==43329== by 0x42355B: process_section_contents (readelf.c:13201) ==43329== by 0x42355B: process_object (readelf.c:16899) ==43329== by 0x402111: process_file (readelf.c:17273) ==43329== by 0x402111: main (readelf.c:17344) ==43329== Address 0x52036ce is 0 bytes after a block of size 78 alloc'd ==43329== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==43329== by 0x40574E: get_data (readelf.c:393) ==43329== by 0x41E5AB: dump_section_as_bytes (readelf.c:12785) ==43329== by 0x42355B: process_section_contents (readelf.c:13201) ==43329== by 0x42355B: process_object (readelf.c:16899) ==43329== by 0x402111: process_file (readelf.c:17273) ==43329== by 0x402111: main (readelf.c:17344) ==43329== ==43329== Invalid read of size 1 ==43329== at 0x41E7C8: dump_section_as_bytes (readelf.c:12905) ==43329== by 0x42355B: process_section_contents (readelf.c:13201) ==43329== by 0x42355B: process_object (readelf.c:16899) ==43329== by 0x402111: process_file (readelf.c:17273) ==43329== by 0x402111: main (readelf.c:17344) ==43329== Address 0x52036ce is 0 bytes after a block of size 78 alloc'd ==43329== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==43329== by 0x40574E: get_data (readelf.c:393) ==43329== by 0x41E5AB: dump_section_as_bytes (readelf.c:12785) ==43329== by 0x42355B: process_section_contents (readelf.c:13201) ==43329== by 0x42355B: process_object (readelf.c:16899) ==43329== by 0x402111: process_file (readelf.c:17273) ==43329== by 0x402111: main (readelf.c:17344) ASAN says: ==48173==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700000d88e at pc 0x56090c bp 0x7ffc4f4c1d50 sp 0x7ffc4f4c1d48 READ of size 1 at 0x60700000d88e thread T0 #0 0x56090b in dump_section_as_bytes /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:12894 #1 0x4e1661 in process_section_contents /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:13201 #2 0x48d720 in process_object /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:16899 #3 0x488475 in process_file /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:17273 #4 0x4856d3 in main /home/ubuntu/thesis/subjects/binutils-gdb-nick/build-asan/binutils/../../binutils/readelf.c:17344 #5 0x7ff239209f44 (/lib/x86_64-linux-gnu/libc.so.6+0x21f44) #6 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