I had a bunch of crashes during last AFL runs.
Problem is next. Object contains local symbol of type STT_NOTYPE
(it just should not be STT_FILE or STT_SECTION to crash).
Has section index greater than SHN_LORESERVE, so next code returns 0
template <class ELFT>
uint32_t ELFFileBase<ELFT>::getSectionIndex(const Elf_Sym &Sym) const { ... if (I >= ELF::SHN_LORESERVE) return 0; return I; }
Then DefinedRegular is created:
if (Sym->st_shndx == SHN_UNDEF) return new (this->Alloc) Undefined(Sym->st_name, Sym->st_other, Sym->getType(), this); return new (this->Alloc) DefinedRegular<ELFT>(*Sym, Sec); }
And finally code is crashes in shouldKeepInSymtab() because Sec is null there.
As was noticed by Rafael, the same happens for absolute
local symbols with name staring from ".L".
Patch fixes that.
You don't need F.