Repository navigation
fix(session): stop RFX geometry from wrapping u16 - #2096
Ki Hyun Park (kihyun1998) wants to merge 2 commits into
Conversation
The RemoteFX decoder computed tile rectangles (xIdx * 64) and clip rectangles (x + width - 1) in u16 from values the server sends. A large tile index, or a zero width or height, panicked debug builds and wrapped in release builds, where a tile could land at the wrong position and an empty rectangle widened the clip to the whole channel. Both are now computed in u32. A tile whose rectangle does not fit in u16 is skipped, as a tile outside the clip region already was. Clip rectangles use exclusive bounds limited to the channel, so a zero-sized region rectangle or channel clips nothing, and a rectangle entirely outside the channel no longer leaves a one-pixel strip at its edge. Devolutions#2095 suggested failing the frame for such a tile; skipping it keeps tiles past the u16 range consistent with other off-screen tiles. Fixes Devolutions#2095
|
Validation:
Note Human-tuned, LLM-assisted content. |
There was a problem hiding this comment.
The PR reworks RemoteFX decode geometry in ironrdp-session to compute tile and clip rectangles in u32, drop empty or out-of-channel clipping rectangles, and skip tiles whose rectangle does not fit in u16, eliminating server-controlled u16 wrapping and debug panics. Independent inspection of pr-head confirms the arithmetic, the empty-rectangle filter, the exclusive 65536 clamp, and the new rstest coverage in the CI-run testsuite are correct and well-targeted. All four specialist candidates are valid low-severity issues: a fully visible edge tile near the u16 boundary is dropped instead of clipped, the 65536 clamp constant has no CI-executable test, a frame whose tiles are all skipped still reports the clip extents as the changed rectangle, and the left/top tile arithmetic could be simplified to checked u16 ops. None blocks the change.
Push a commit after addressing these findings. If no code change is needed, you may resolve inline threads and comment @github-actions review-ready to request human review.
A tile that starts inside the u16 range but ends past it was skipped, dropping the part a clipping rectangle still covers. It is now cut at the end of the range, as the clipping rectangles are, and only a tile that starts past the range is skipped. `clipping_rectangles` and `tiles_to_rectangles` are exposed under the `__test` feature so that the testsuite pins the u16 limit, which the 64x64 example sequence cannot reach.
|
This pull request may overlap with #2094. Both PRs harden the RemoteFX decoder in ironrdp-session against out-of-range server-supplied values in the same file, though This notice is advisory only. Automated review continues as usual, and how these pull requests relate is for maintainers and authors to decide. Note LLM-assisted content (no human feedback). |
|
On the overlap with #2094: the two fix different defects in the same decoder and are independent. #2094 checks the tile quantization indexes in Note Human-tuned, LLM-assisted content. |
The RemoteFX decoder computed tile rectangles (xIdx * 64) and clip rectangles (x + width - 1) in u16 from values the server sends. A large tile index overflowed, panicking debug builds and wrapping in release builds, where the tile could land at the wrong position. A zero width or height could underflow the same way and widen the clip to the whole channel, or produce an inverted rectangle.
Tile positions are now checked in u16 and clip rectangles computed in u32. A tile that starts past the u16 range is skipped, which draws the same as a tile outside the clip region, and a tile crossing the end of the range is cut there. Clip rectangles use exclusive bounds limited to the channel, so a zero-sized region rectangle or channel clips nothing, and a rectangle entirely outside the channel no longer leaves a one-pixel strip at its edge.
#2095 suggested failing the frame for such a tile; skipping it keeps tiles past the u16 range consistent with other off-screen tiles.
Fixes #2095