Skip to content

Fix Win7 RDP PDU and bitmap stride handling#1408

Open
cxxzhang (cxxzhang) wants to merge 2 commits into
Devolutions:masterfrom
cxxzhang:uniremote-win7-rdp-fixes
Open

Fix Win7 RDP PDU and bitmap stride handling#1408
cxxzhang (cxxzhang) wants to merge 2 commits into
Devolutions:masterfrom
cxxzhang:uniremote-win7-rdp-fixes

Conversation

@cxxzhang

Copy link
Copy Markdown

No description provided.

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

This PR targets two Windows 7 RDP interoperability issues in ironrdp-session. First, it handles the case where a Win7 server concatenates multiple Share Control PDUs inside a single MCS Send Data Indication on the I/O channel by iterating over each sub-PDU. Second, it fixes bitmap rendering when the server sends bitmap data whose per-row stride (source width) is wider than the destination rectangle width, by introducing a normalize_bitmap_rows helper that repacks rows to the destination width before handing data to the apply_* functions.

Changes:

  • Add process_io_channel_data_indication to split and process concatenated Share Control PDUs on the I/O channel.
  • Add normalize_bitmap_rows helper and route all compressed (RDP6/RLE) and uncompressed bitmap paths through it to strip stride padding / extra columns down to the destination rectangle width.
  • Replace the previous inline row-padding-stripping logic in the uncompressed path with the shared helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/ironrdp-session/src/x224/mod.rs Routes I/O-channel data through a new PDU-splitting method; splitting assumes a Share Control Header and mis-handles Multitransport Request PDUs.
crates/ironrdp-session/src/fast_path.rs Adds normalize_bitmap_rows and uses it across all bitmap color-depth paths to normalize source stride to the destination rectangle width.

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

Comment on lines +160 to +169
let total_length = usize::from(u16::from_le_bytes([data[offset], data[offset + 1]]));
if total_length == 0 || offset + total_length > data.len() {
if offset == 0 {
return self.process_io_channel(data_ctx);
}
return Err(reason_err!(
"X224",
"invalid concatenated Share Control PDU length: {total_length}"
));
}

@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.

Thank you for the PR!


const DEFAULT_POINTER_CACHE_SIZE: u16 = 32;

/// 中文注释:根据连接配置和服务端能力生成 Client Confirm Active,legacy 图形模式会跳过增强 surface 能力。

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.

Could you translate the comments in English? Not many of us understands Chinese. Thanks! 🙂

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