fix(pj_plugins): validate a spliced GridMap right after attaching its bytes (SDK 0.26.1) - #188
Merged
Merged
Conversation
… bytes (SDK 0.26.1) deserializeGridMap accepts a header-only wire (the functional-v2 splice form) and leaves the data-length check to validateGridMap(). Both host splice attachment paths, the functional parser handle and the parser-module runtime, now run that check as soon as the bytes are attached, so a spliced GridMap whose bytes cannot cover its declared cells is rejected as a contract violation instead of reaching consumers. Host-side only: no header layout, ABI or wire change. Tests cover both paths with a two-column grid spliced with a single byte. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
Follow-up to #185 from its review:
deserializeGridMapaccepts a header-only wire (the functional-v2 splice form) and defers the data-length check tovalidateGridMap(), but neither host splice-attachment path ran that check after attaching the bytes. A spliced GridMap whose bytes could not cover its declared cells reached consumers unchecked.Both paths,
MessageParserHandle(functional v2 sink) andParserModuleRuntime(ownObjectOutput), now callvalidateGridMap()immediately after attachment and reject failures as a contract violation. Docs updated to say the host validates on attach and consumers validate again defensively.Test plan
HostV2PathRejectsSplicedGridMapWhoseBytesDoNotCoverTheCellsandParserModuleRuntime.RejectsGridMapSpliceWhoseBytesDoNotCoverTheCells(new fixture claimsplice-grid-map-short) failed before the change, pass after./build.sh --debug && ./test.sh(ASAN): 84/84Release
PATCH:
VERSION0.26.1, CHANGELOG entry. Host-side only; no header layout, ABI or wire change.🤖 Generated with Claude Code