Skip to content

fix(pdu): set COMPRESSION_USED on the FastPath update header when compressed#1382

Merged
Benoît Cortier (CBenoit) merged 1 commit into
Devolutions:masterfrom
lamco-admin:fix/fastpath-encode-compression-flag
Jun 26, 2026
Merged

fix(pdu): set COMPRESSION_USED on the FastPath update header when compressed#1382
Benoît Cortier (CBenoit) merged 1 commit into
Devolutions:masterfrom
lamco-admin:fix/fastpath-encode-compression-flag

Conversation

@glamberson

Copy link
Copy Markdown
Contributor

FastPathUpdatePdu::encode writes the update header byte before setting the COMPRESSION_USED bit, so a PDU encoded with compression_flags set emits the trailing compression flags byte but never marks it in the header.

FastPathUpdatePdu::decode keys on that bit (bits 6..7 of the update header) to decide whether to consume the compression flags byte. With the bit clear, it skips that byte and reads the data length from the wrong offset, so a compressed FastPath update does not round-trip through encode/decode.

This is currently latent: nothing in the workspace encodes a compressed fast-path output PDU (the server only decompresses, on the client side), so the path is never exercised. It surfaces as soon as anything does (it turned up while writing a bulk-decompression round-trip test).

The fix sets the bit on the header before it is written, and adds a round-trip test (compressed_update_round_trips) covering the compressed case.

…pressed

FastPathUpdatePdu::encode wrote the update header byte before setting the
COMPRESSION_USED bit, so a PDU encoded with compression flags emitted the
trailing compression flags byte but never marked it in the header. The decoder
keys on that bit to decide whether to consume the compression byte, so a
compressed FastPath update did not round-trip: decode read the length field
from the wrong offset and failed with NotEnoughBytes.

Set the bit before writing the header, and add a round-trip test for the
compressed case.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes FastPath update PDU encoding so the update header correctly advertises the presence of the trailing compression flags byte when compression_flags is set, restoring encode/decode round-tripping for compressed FastPath updates in ironrdp-pdu.

Changes:

  • Set the COMPRESSION_USED bit on the FastPath update header before writing the header byte in FastPathUpdatePdu::encode.
  • Add a regression test ensuring a compressed FastPath update PDU round-trips through encode/decode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/ironrdp-pdu/src/basic_output/fast_path/mod.rs Fixes header bit emission so decode consumes the compression flags byte correctly.
crates/ironrdp-pdu/src/basic_output/fast_path/tests.rs Adds a round-trip test covering the compressed FastPath update case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CBenoit Benoît Cortier (CBenoit) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thank you!

@CBenoit Benoît Cortier (CBenoit) merged commit 3f96d00 into Devolutions:master Jun 26, 2026
21 checks passed
David T. Martel (David-Martel) pushed a commit to David-Martel/IronRDP that referenced this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants