Repository navigation
fix(artifacts): inventory universal slices REA cannot structurally index - #3283
Merged
Merged
Conversation
inspect_artifact and extract_artifact rejected a valid universal Mach-O when one slice was outside the structural index, such as XLD's big-endian PowerPC slice. The whole inventory failed with "Artifact is invalid or has changed. Get a fresh copy and try again." When lipo reports every slice's range, the slices are now inventoried from those ranges with a limitation naming the unsupported structure, as the reader already does for files without structural facts. When lipo omits a range, the failure is reported as unavailable support rather than a corrupt artifact. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
|
readFatSlices returned at the first unsupported slice, so a later malformed slice went unchecked: with lipo's ranges now inventoried for unsupported structure, a malformed little-endian slice after a big-endian one was accepted while the reverse order was rejected. Unsupported slices are now remembered and the remaining slices are still validated, so malformed structure wins in either order. Adds portable fake-lipo coverage for complete ranges, missing ranges (unavailable) and malformed slices on both sides of a big-endian slice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 tasks done
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.
Problem
inspect_artifactandextract_artifactrefused a valid universal Mach-O whenever one slice fell outside REA's structural index. On this Mac,/Applications/XLD.app/Contents/MacOS/XLD(an installed, ad-hoc signed app with x86_64, i386, ppc and arm64 slices) failed entirely:The artifact is fine. Only the big-endian PowerPC slice is unsupported, and the "fresh copy" advice is wrong.
Fix
MachOSliceArtifactReaderalready inventories slices fromlipo's ranges, with a limitation, when structural Mach-O facts are unavailable (not-mach-o). Anunsupportedstructural result now takes the same path whenliporeported every slice's offset and size. Each slice carries the limitationStructural Mach-O facts were unsupported (<reason>); slice range is based on lipo output.The existing bounds check against the file size still applies.When
lipoomits a range (for example a thin big-endian file), the reader still fails. It now uses theunavailablereason, which reports missing support for the target, instead offormat, which reports a corrupt artifact.Validation
Real data:
rea inspect-artifact /Applications/XLD.app/Contents/MacOS/XLD: before, the error above; after, 4 slices in 1.15 s. Each slice's size and SHA-256 equals the byte range from XLD's FAT table (checked independently in Python).rea extract-artifacton the same binary: before, the same error; after, it succeeds.Tests:
tests/boundary/providers/native/machoSliceReader.test.tsruns the reallipoon a FAT file with a little-endian arm64 slice and a big-endian ppc slice. It fails on main and passes with this change.npm run test:focusedon the slice-reader tests (5 files, 23 tests) passes.npm run check:fastpasses.🤖 Generated with Claude Code