bfd_elf_string_from_elf_section() function of bfd/elf.c doesn't check if shindex is valid or not. I generated a file with my fuzzer which crash nm: => Segfault at bfd/elf.c, line 278 abdf->section= abdf->section_count=0 abdf->shindex=65288 (!) Proposition of fix: replace if (strindex == 0) return ""; with if (strindex == 0 || abfd->section_count < shindex) return "";
Created attachment 1832 [details] Fuzzed ELF (contains many bugs)
http://sourceware.org/ml/binutils-cvs/2007-05/msg00069.html