This is an archive of the discontinued LLVM Phabricator instance.

Detect malformed LC_LINKER_COMMANDs in Mach-O binaries
ClosedPublic

Authored by mtrent on Mar 9 2019, 12:09 PM.

Details

Summary

llvm-objdump can be tricked into reading beyond valid memory and
segfaulting if LC_LINKER_COMMAND strings are not null terminated. libObject
does have code to validate the integrity of the LC_LINKER_COMMAND struct,
but this validator improperly assumes linker command strings are null
terminated.

The solution is to report an error if a string extends beyond the end of
the LC_LINKER_COMMAND struct.

Diff Detail

Repository
rL LLVM

Event Timeline

mtrent created this revision.Mar 9 2019, 12:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2019, 12:09 PM
Herald added a subscriber: rupprecht. · View Herald Transcript
pete accepted this revision.Mar 9 2019, 3:16 PM

LGTM.

This revision is now accepted and ready to land.Mar 9 2019, 3:16 PM
This revision was automatically updated to reflect the committed changes.