Repository navigation
[C] Reject a wire blockLength shorter than the fixed fields of the acting version - #1177
Open
slachiewicz wants to merge 1 commit into
Open
slachiewicz wants to merge 1 commit into
slachiewicz wants to merge 1 commit into
Conversation
…ting version. <msg>_wrap_for_decode and <group>_wrap_for_decode return NULL with E100 or E108 below the extent of the fields present at the acting version. The minimum is per version because older versions have shorter blocks, so do not compare against <msg>_sbe_block_length(). Empty groups are not checked.
This was referenced Nov 14, 2026
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.
Generated C decoders take the message and group blockLength from the wire and read fixed fields at their schema offsets, so a frame whose blockLength is shorter than those fields, with the buffer ending accordingly, makes the field accessors read past the buffer.
_wrap_for_decode and _wrap_for_decode now return NULL with errno E100 or E108 for a blockLength below the extent of the fields present at the acting version. The minimum is per version, so older versions still decode, including composites that gained a member in a later version, and empty groups are not checked. A decoder that passes its own schema version as the acting version, rather than the version from the header, now rejects shorter blocks from older senders. Generators.minBlockLengthExpression is shared with the C++ fix and identical in both PRs.
Part of #969.
Verified: CWireBlockLengthTest fails on master (3 of 5 tests) and passes here, and MinBlockLengthExpressionTest covers the composite case; sbe-tool checkstyle and test, cppbuild and cppbuild --debug-build --sanitise-build pass.