This is an archive of the discontinued LLVM Phabricator instance.

[ELF.h] - Check the case when e_shstrndx=SHN_XINDEX, but the corresponding sh_link is broken.
ClosedPublic

Authored by grimar on Jul 29 2019, 3:10 AM.

Details

Summary

When e_shstrndx is equal to SHN_XINDEX,
the index of the section string table section should
be taken from the sh_link field of the section
header at index 0.

If sh_link is broken, e.g. contains an index that is
larger than number of sections, then error is reported.

This error message was untested before.

This is almost the same as D65388, but now the code
in ELF.h is tested.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Jul 29 2019, 3:10 AM
MaskRay accepted this revision.Jul 31 2019, 5:03 AM

should be taken from zero section sh_link field

the sh_link field of the section header at index 0?

test/Object/invalid.test
610 ↗(On Diff #212143)

null section -> the section header at index 0

This revision is now accepted and ready to land.Jul 31 2019, 5:03 AM
grimar updated this revision to Diff 212584.Jul 31 2019, 8:11 AM
grimar marked an inline comment as done.
grimar edited the summary of this revision. (Show Details)
  • Addressed comments.

James, since this is independent from D65388,
are you OK to land it?

grimar added a comment.Aug 5 2019, 4:09 AM

Ping. James?

jhenderson accepted this revision.Aug 6 2019, 3:00 AM

LGTM, with nits fixed. Sorry, last week was very busy. Just working through my backlog now.

test/Object/invalid.test
632 ↗(On Diff #212584)

contains the index of a
larger than the number

grimar added a comment.Aug 6 2019, 3:02 AM

LGTM, with nits fixed. Sorry, last week was very busy. Just working through my backlog now.

No worries, thanks for review!

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2019, 2:28 AM