Repository navigation
fix(parsers): stop reading every RangeError as a format failure - #10602
Merged
Merged
Conversation
…gebra Add ParseFailure (malformed, truncated, unsupported, limit, with format, offset and field) and its one carrier, ParseFailureError, in the domain. BinaryReader now names truncation and the field it read, and its native format and resource failures are ParseFailureError subclasses. Providers projected a format failure with their own instanceof ladder, and some dropped the selected path from the invalid_format message. parseFailureAnalysisError now owns that projection for the native, Go, devicetree, V8, Windows Shortcut and Electron fuse providers. The V8 code cache, Windows Shortcut and Electron fuse format classes are removed in favour of the algebra. The architecture guard counts raw Buffer and DataView reads, plain Error throws in parser folders and plain JSON.parse of parser input against baselines that can only shrink.
Mach-O, Swift and Objective-C metadata parsers threw RangeError for a truncated or malformed record, so their catch sites treated any RangeError as a partial decode: a call stack overflow or a host string limit became an "unresolved" metadata reason, and the IL2CPP Mach-O path reported it as a malformed container. Those parsers and the CIL method body reader now throw ParseFailureError. hostRangeErrorKind is the one interpreter of a host RangeError (stack overflow, host capacity, raw out-of-bounds read), and parseFailureFromCause admits only a parse failure or a raw out-of-bounds read as evidence about the input. Fixup stream catch-alls rethrow host limits. The architecture guard counts the remaining direct instanceof RangeError checks.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The reviewed changes appear safe to merge, with no new blocking issue found. SummaryMoves known parser failures to
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
R["Bounded Objective-C or Swift read"] --> C{"Expected read failure?"}
C -->|"Reported parse failure or invalid UTF-8"| P["Keep partial facts and a reason"]
C -->|"Unexpected host error"| H["Propagate the error"]
V["Swift vtable exceeds 20,000 slots"] --> L["Report a named decode limit"]
L --> C
Reviews (6) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
# Conflicts: # docs/development/tool-design.md # scripts/verify/architecture-guard-baselines.json # scripts/verify/architecture-guards.mjs # src/domain/parseFailure.ts # src/native/metadata/BinaryContainer.ts
1 of 22 tasks
# Conflicts: # src/il2cpp/Il2cppBinaryImage.ts # src/native/AppleMachoSelection.ts # src/native/NativeMachoInspection.ts
11 tasks
22 tasks
20 of 29 tasks
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.
Summary
Mach-O, Objective-C, Swift, and managed metadata readers could turn a stack overflow or host capacity failure into a malformed-input result. This change reports known format failures through the shared
ParseFailureErroralgebra and propagates unexpected host failures. It also reports the Swift vtable decoder cap as a resource limit.Host range error codes do not identify the operation that failed: reads, writes, and allocations can share them. Only explicit parser failures are treated as input evidence; raw host failures remain unclassified. Bounded readers own their bounds checks. Objective-C and Swift metadata catches now preserve unexpected failures rather than recording partial facts.
Validation
npm run check:fastand architecture guards passed; formatting checked for changed files.No schema or migration change. No issue was filed; this was found in an error-boundary audit.
Author readiness
Human owner:
Before merge
type(scope): outcome.