fix(pdu): correct ShareDataHeader uncompressedLength calculation#1148
Merged
Benoît Cortier (CBenoit) merged 1 commit intoDevolutions:masterfrom Mar 5, 2026
Conversation
The uncompressedLength field in ShareDataHeader::encode() included the sizes of pduType2, compressedType, and compressedLength fields (4 extra bytes) on top of the actual PDU payload size. Per MS-RDPBCGR 2.2.8.1.1.1.2, uncompressedLength should contain only the payload size. This matches FreeRDP's implementation. pacmancoder confirmed this as a bug in May 2024: Devolutions#447 (comment) Fixes part of Devolutions#447
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
ShareDataHeader::encode()was calculatinguncompressedLengthaspayload_size + 4(adding pduType2, compressedType, and compressedLengthfield sizes). Per MS-RDPBCGR 2.2.8.1.1.1.2, this field should contain
only the uncompressed payload size.
Vladyslav Nikonov (@pacmancoder) confirmed this as a bug in May 2024
(#447 (comment)):
"pretty sure this is a bug on our side"
FreeRDP encodes only the payload size. Servers tolerate both values since
the decode path does not validate
uncompressedLengthagainst actualpayload size, but the current encoding does not match the spec.
Changes
ironrdp-pdu/src/rdp/headers.rsironrdp-testsuite-core/src/rdp.rsVerification
cargo xtask check fmt,cargo xtask check lints, andcargo xtask check testsall pass.Fixes part of #447