This is an archive of the discontinued LLVM Phabricator instance.

[Object/ELF] - Refine the error reported when section's offset + size overruns the file buffer.
ClosedPublic

Authored by grimar on Dec 2 2019, 3:56 AM.

Details

Summary

This is a follow-up requested in comments for D70826.

It changes the message from
"section X has a sh_offset (Y) + sh_size (Z) that cannot be represented"
to
"section X has a sh_offset (Y) + sh_size (Z) that is greater than the file size S"

when section's sh_offset + sh_size overruns a file buffer.

Diff Detail

Event Timeline

grimar created this revision.Dec 2 2019, 3:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2019, 3:57 AM

Thanks for this. Just one comment.

llvm/include/llvm/Object/ELF.h
414

The file size should be in brackets and have the 0x prefix (i.e. file size (0x1234)).

grimar updated this revision to Diff 231883.Dec 3 2019, 5:31 AM
grimar marked 2 inline comments as done.
  • Addressed review comment.
llvm/include/llvm/Object/ELF.h
414

Yeah, sorry, done.

This revision is now accepted and ready to land.Dec 3 2019, 5:56 AM
This revision was automatically updated to reflect the committed changes.