This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS
ClosedPublic

Authored by grimar on Oct 13 2016, 5:52 AM.

Details

Summary

Issue was revealed by AFl and I was able to generate such object using yaml2obj,
it is reasonable to fix probably.

When object has more than one SHT_MIPS_OPTIONS, each except the last one is destroyed after
placing into Sections array.
Sections array contains dead pointers finally. LLD may crash then.

Do we want fixing it ?
If so I can prepare patch for fixing the same for SHT_MIPS_REGINFO and SHT_MIPS_ABIFLAGS.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 74502.Oct 13 2016, 5:52 AM
grimar retitled this revision from to [ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS.
grimar updated this object.
grimar added reviewers: ruiu, rafael, atanasyan, davide.
grimar added subscribers: llvm-commits, grimar, evgeny777.
atanasyan accepted this revision.Oct 13 2016, 5:57 AM
atanasyan edited edge metadata.

LGTM

I think it is impossible to get multiple SHT_MIPS_OPTIONS sections in a real case. But as far as the fix so trivial let's do it.

This revision is now accepted and ready to land.Oct 13 2016, 5:57 AM
ruiu accepted this revision.Oct 13 2016, 10:50 AM
ruiu edited edge metadata.

LGTM

ELF/InputFiles.cpp
328 ↗(On Diff #74502)

Please include the filename. Error messages need to start with lowercase letters.

This revision was automatically updated to reflect the committed changes.