Page MenuHomePhabricator

[Sparc] Avoid writing outside array in applyFixup
ClosedPublic

Authored by dcederman on Aug 20 2018, 6:16 AM.

Details

Summary

If an object file ends with a relocation that is smaller than 4 bytes we will write outside the Data array and trigger an "Invalid index" assertion.

Diff Detail

Event Timeline

dcederman created this revision.Aug 20 2018, 6:16 AM
jyknight accepted this revision.Aug 26 2018, 9:57 AM
jyknight added inline comments.
lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
103

I see this is the same way other targets do it, so, fine. But it seems rather unfortunate that this is separate from MCFixupKindInfo. And, for that matter, that applyFixup is implemented in every AsmBackend, despite doing afaict the same thing in each of them, only implemented slightly differently.

*shrug*.

This revision is now accepted and ready to land.Aug 26 2018, 9:57 AM
This revision was automatically updated to reflect the committed changes.