feat(macho): patch universal binaries in 64-bit fat containers - #828
Merged
Conversation
indaco
force-pushed
the
feat/parse-fat64-bottles
branch
from
August 10, 2026 13:59
0d30009 to
d328de9
Compare
A binary shipped in a 64-bit fat container is now walked slice by slice like any other universal binary, instead of aborting its patch with an InvalidMagic that misdescribes a perfectly valid Mach-O file. The slice bounds guards are shared with the 32-bit path, so a malformed 64-bit arch table fails closed the same way. Cached kegs are re-relocated once: a keg holding such a binary was stored with its install-prefix paths left unpatched.
indaco
force-pushed
the
feat/parse-fat64-bottles
branch
from
August 10, 2026 13:59
d328de9 to
ead0e69
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A universal binary shipped in a 64-bit fat container is now patched like any other binary. The parser recognised only the 32-bit container magic, so such a file was rejected as
InvalidMagic- a misleading error for a perfectly valid Mach-O - and the patcher gave up on it, leaving its install-prefix paths pointing at the build prefix. The slice bounds guards are shared with the 32-bit path, so a malformed 64-bit arch table still fails closed.RELOC_LOGIC_VERSIONmoves to 7 so cached kegs are re-relocated once: a keg cached under the old version could hold such a binary with its paths unpatched, and that cache is served before any re-patching happens.This does not change what malt can do with bottles larger than 4 GiB.
Related Issue
Notes for Reviewers