Skip to content

Commit 8c18a5d

Browse files
committed
fix(graphics): add rect to decoder_reset test for region validation
The merged progressive primitives PR (#1196) added validation that a ProgressiveRegion must contain at least one rectangle. The test used an empty rects vec which now fails decoding.
1 parent fce21b9 commit 8c18a5d

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

crates/ironrdp-graphics/src/progressive.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,14 +1262,20 @@ mod tests {
12621262
let mut decoder = ProgressiveDecoder::new();
12631263

12641264
// Decode a minimal valid stream to create a context
1265+
use ironrdp_pdu::codecs::rfx::RfxRectangle;
12651266
use ironrdp_pdu::codecs::rfx::progressive::{
12661267
ProgressiveBlock, ProgressiveContextPdu, ProgressiveFrameBeginPdu, ProgressiveFrameEndPdu,
12671268
ProgressiveRegion, ProgressiveSyncPdu, encode_progressive_stream,
12681269
};
12691270

12701271
let region = ProgressiveRegion {
12711272
tile_size: 0x40,
1272-
rects: vec![],
1273+
rects: vec![RfxRectangle {
1274+
x: 0,
1275+
y: 0,
1276+
width: 64,
1277+
height: 64,
1278+
}],
12731279
quant_vals: vec![],
12741280
quant_prog_vals: vec![],
12751281
flags: 0,

crates/ironrdp-pdu/src/codecs/rfx/progressive.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
1111
use core::iter;
1212

13-
use super::RfxRectangle;
1413
use ironrdp_core::{
1514
Decode, DecodeResult, Encode, EncodeResult, ReadCursor, WriteCursor, cast_length, ensure_fixed_part_size,
1615
ensure_size, invalid_field_err,
1716
};
1817

18+
use super::RfxRectangle;
19+
1920
// Wire constants
2021
const SYNC_MAGIC: u32 = 0xCACCACCA;
2122
const SYNC_VERSION: u16 = 0x0100;

0 commit comments

Comments
 (0)