Bound malformed tokens, indices and placement recursion - #2151
Merged
Merged
Conversation
beachtom
reviewed
Sep 16, 2026
beachtom
approved these changes
Sep 16, 2026
Author
|
Thanks for updating the branch. I noticed the merge resolution dropped the missing/invalid FILE_SCHEMA guards in both OpenModel and OpenModelFromCallback. We should retain those checks alongside ALLOW_INCOMPATIBLE_SCHEMA_ALIASES, so a missing header returns -1 and closes the model instead of throwing. I can push a small follow-up to preserve both. |
Collaborator
|
Yeah I spotted that - will sort |
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.
Fixes #2150.
Bound EOF scanning and triangle access, detect cyclic/deep placements, and guard missing FILE_SCHEMA. Tokenizer failures now propagate through the loader to both OpenModel entry points, which close the failed model and return -1 instead of exposing a partial model. Bounded child-process tests cover malformed tokens after valid headers and records, callback/buffer loading, chunk boundaries and successful loads after repeated failures. Text-escape decoding is handled separately.
Validation on this branch's fresh Emscripten 4.0.10 builds: 11 PR regression tests and 89 existing functional/API tests pass in Node 24.13.0; 6 tests pass in headless Chromium using the browser WASM. The six browser cases cover late tokenizer rejection; native ASan/UBSan also passed 2400 tokenizer cases.
The test file and fixtures are introduced by this PR and are not yet in upstream main. The test constructs additional edge cases from the fixtures. To run it, use a clean checkout of the PR branch (with Emscripten configured):
Reproduction: minimal IFC input; all fixtures; MalformedInput.spec.js.
Build environment: Node 24.13.0, Emscripten 4.0.10.