https://sourceware.org/bugzilla/show_bug.cgi?id=20922
Bug ID: 20922 Summary: STRIP crashes during copy of special section fields Product: binutils Version: 2.28 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: boehme.marcel at gmail dot com Target Milestone: --- Dear all, The following bug was found with AFLFast, a fork of AFL, in a 24 hour fuzzing session on Binutils. Thanks also to Van-Thuan Pham. The linker crashes with an invalid read of size 4 for the following execution in Binutils trunk on Ubuntu 16.04 x86_64 and 14.04 x86_64. However, it does *not* crash for preinstalled version v2.26.1 on Ubuntu 16.04 or preinstalled version v2.24 on Ubuntu 14.04 x86_64. $ printf "\x7fELF\x01\x01\x0100000000000\x03\x00000000000000\x0c\x00\x00\x0000000000\x00\x0000\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000\x00\x00\x00\x000000000000000000\x00\x00\x00\x00\x00\x00\x00\x00000000000000\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000\x00\x00\x00\x000000000000000000\x00\x00\x00\x00\x00\x00\x00\x00000000000000\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000\x00\x00\x00\x00000\xff\xff00000000\x00\x00\x000\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x0000000000\x00\x00\x00\x00\x00\x00\x00\x000000000000000000\x00\x00\x00\x00000000000000" > test $ strip test ./binutils/strip-new: test: warning: sh_link not set for section `' ./binutils/strip-new: stZoIaxG: warning: sh_link not set for section `' Segmentation fault UBSAN says: ../../bfd/elf.c:1253:6: runtime error: member access within null pointer of type 'const struct Elf_Internal_Shdr' Valgrind says: ==84818== Invalid read of size 4 ==84818== at 0x56E746: section_match (elf.c:1258) ==84818== by 0x56E746: find_link.isra.4 (elf.c:1274) ==84818== by 0x570DCB: copy_special_section_fields (elf.c:1364) ==84818== by 0x57C26D: _bfd_elf_copy_private_bfd_data (elf.c:1465) ==84818== by 0x42B87B: copy_object.part.18 (objcopy.c:2517) ==84818== by 0x42F435: copy_object (objcopy.c:1849) ==84818== by 0x42F435: copy_file (objcopy.c:2879) ==84818== by 0x41670E: strip_main (objcopy.c:3788) ==84818== by 0x41670E: main (objcopy.c:4888) ==84818== Address 0x4 is not stack'd, malloc'd or (recently) free'd Best regards, - Marcel -- 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