Created attachment 13585 [details] poc Hi there, I crashed `nm-new -a -l` with a fuzzer. - binutils version: 2.38(Head), commit af51804103a08cd1e12edc4f4a30eec2c5c4f9e8 - Compiler: clang12 - Platform: Ubuntu 18.04.5 LTS, x86_64 - Reproduce: run `nm-new -a -l poc` AddressSanitizer report: ==640==ERROR: AddressSanitizer: SEGV on unknown address 0x621050000558 (pc 0x000000ced0ab bp 0x7ffff11c0d70 sp 0x7ffff11c0ca0 T0) ==640==The signal is caused by a READ memory access. #0 0xced0ab in reloc_processing /binutils_latest/repo/bfd/coff-tic30.c:165:35 #1 0xceac05 in coff_slurp_reloc_table /binutils_latest/repo/bfd/./coffcode.h:5120:7 #2 0xce63d8 in coff_canonicalize_reloc /binutils_latest/repo/bfd/./coffcode.h:5238:13 #3 0x4e96db in bfd_canonicalize_reloc /binutils_latest/repo/bfd/bfd.c:1579:10 #4 0x4d2276 in get_relocs /binutils_latest/repo/binutils/nm.c:913:25 #5 0x50e6ba in bfd_map_over_sections /binutils_latest/repo/bfd/section.c:1383:5 #6 0x4d147a in print_symbol /binutils_latest/repo/binutils/nm.c:1037:8 #7 0x4ceaeb in print_symbols /binutils_latest/repo/binutils/nm.c:1152:7 #8 0x4cd23c in display_rel_file /binutils_latest/repo/binutils/nm.c:1279:5 #9 0x4c97dd in display_file /binutils_latest/repo/binutils/nm.c:1446:7 #10 0x4c90db in main /binutils_latest/repo/binutils/nm.c:1965:12 #11 0x7fda9a2cb0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #12 0x41c55d in _start (/out_bin/nm-new+0x41c55d) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /binutils_latest/repo/bfd/coff-tic30.c:165:35 in reloc_processing ==640==ABORTING
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e039f7ed8675ddc9d2aa1e60df49dbc8d2836fc7 commit e039f7ed8675ddc9d2aa1e60df49dbc8d2836fc7 Author: Alan Modra <amodra@gmail.com> Date: Fri Aug 6 20:48:41 2021 +0930 PR28175, Segment fault in coff-tic30.c reloc_processing The obj_convert table shouldn't be accessed without first checking the index against the table size. PR 28175 * coff-tic30.c (reloc_processing): Sanity check reloc symbol index. * coff-z80.c (reloc_processing): Likewise. * coff-z8k.c (reloc_processing): Likewise.
Fixed for 2.38