This is an archive of the discontinued LLVM Phabricator instance.

[Object/ELF] - Do not crash on invalid section index.
ClosedPublic

Authored by grimar on Sep 30 2016, 2:10 AM.

Details

Summary

If object has wrong (large) string table index and
also incorrect large value for amount of sections in total,
then section index passes the check:

  if (Index >= getNumSections())
    return object_error::invalid_section_index;

But result pointer then is far after end of file data, what
result in a crash.

Patch fixes the issue.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 73010.Sep 30 2016, 2:10 AM
grimar retitled this revision from to [Object/ELF] - Do not crash on invalid section index..
grimar updated this object.
grimar added reviewers: rafael, davide.
grimar added subscribers: llvm-commits, grimar, evgeny777.
rafael accepted this revision.Oct 14 2016, 8:19 PM
rafael edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 14 2016, 8:19 PM
This revision was automatically updated to reflect the committed changes.