Repository navigation
[C++] Reject a wire blockLength shorter than the fixed fields of the acting version - #1176
Open
slachiewicz wants to merge 1 commit into
Open
slachiewicz wants to merge 1 commit into
slachiewicz wants to merge 1 commit into
Conversation
…acting version. The message and group decoders must not accept a blockLength 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 replace it with sbeBlockLength(). 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 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.
wrapForDecode, the decoding constructor and the group wrapForDecode now reject a blockLength below the extent of the fields present at the acting version (E100 for messages, E108 for groups). The minimum is generated per version, so blocks from older schema versions still decode, including composites that gained a member in a later version, and a group with numInGroup 0 is 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. The helper that computes the minimum lives in Generators so the C generator can share it.
Part of #969.
Verified: WireBlockLengthTest fails on master (3 of 5 tests, no exception thrown) and passes here, and MinBlockLengthExpressionTest covers the composite case; sbe-tool checkstyle and test, cppbuild and cppbuild --debug-build --sanitise-build pass.