This is an archive of the discontinued LLVM Phabricator instance.

[Object/ELF] - Do check for invalid section header entry size earlier.
AbandonedPublic

Authored by grimar on Sep 30 2016, 3:35 AM.

Details

Reviewers
davide
rafael
Summary

Zero value in e_shentsize was the reason of crash in lld.
When we have zero size and huge amount of sections,
resize() in below code could fail.

template <class ELFT>
void elf::ObjectFile<ELFT>::initializeSections(
    DenseSet<StringRef> &ComdatGroups) {
  uint64_t Size = this->ELFObj.getNumSections();
  Sections.resize(Size);

No any new testcase as this fatal message is already has one.

Diff Detail

Event Timeline

grimar updated this revision to Diff 73028.Sep 30 2016, 3:35 AM
grimar retitled this revision from to [Object/ELF] - Do check for invalid section header entry size earlier..
grimar updated this object.
grimar added reviewers: rafael, davide.
grimar added subscribers: llvm-commits, grimar, evgeny777.
grimar abandoned this revision.Oct 10 2016, 4:52 AM

I'll revisit this one to find more localized fix.