Skip to content

Commit 67f3c63

Browse files
authored
fix(egfx): tolerate unknown capability versions instead of failing decode (#1298)
1 parent c56ea16 commit 67f3c63

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • crates/ironrdp-egfx/src/pdu

crates/ironrdp-egfx/src/pdu/cmd.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1593,11 +1593,24 @@ impl<'de> Decode<'de> for CapabilitySet {
15931593
fn decode(src: &mut ReadCursor<'de>) -> DecodeResult<Self> {
15941594
ensure_fixed_part_size!(in: src);
15951595

1596-
let version = CapabilityVersion::try_from(src.read_u32())?;
1596+
let version_raw = src.read_u32();
15971597
let data_length: usize = cast_length!("dataLength", src.read_u32())?;
15981598

15991599
ensure_size!(in: src, size: data_length);
16001600
let data = src.read_slice(data_length);
1601+
1602+
// Tolerate capability versions this build doesn't recognize instead of
1603+
// failing the whole PDU. A strict error here aborts decoding of the
1604+
// entire CapabilitiesAdvertise during EGFX negotiation, which can
1605+
// prevent a connection from being established at all when a client
1606+
// advertises a capset version outside the set enumerated below
1607+
// (observed with the macOS "Windows App" / Microsoft Remote Desktop
1608+
// client). Preserving the raw bytes as `Unknown` lets negotiation
1609+
// complete so the server can still select a mutually supported version.
1610+
let Ok(version) = CapabilityVersion::try_from(version_raw) else {
1611+
return Ok(CapabilitySet::Unknown(data.to_vec()));
1612+
};
1613+
16011614
let mut cur = ReadCursor::new(data);
16021615

16031616
let size = match version {

0 commit comments

Comments
 (0)