Skip to content

Commit 962182a

Browse files
author
Greg Lamberson
committed
feat(fuzz): add egfx PDU decoder fuzz target
Adds a byte-stream fuzz target for the Display Pipeline Virtual Channel Extension (MS-RDPEGFX) PDU decoders in `ironrdp-egfx`. Matches the pattern of the existing six fuzz targets in `fuzz/fuzz_targets/`: the libFuzzer target dispatches `&[u8]` input to a single oracle function in `ironrdp-fuzzing::oracles`. The new oracle `egfx_pdu_decode` exercises: - `GfxPdu` (umbrella enum covering all 23 EGFX message types) - `CacheToSurfacePdu` (sole sub-PDU with an independent Decode impl) - `CapabilitySet` - `Avc420BitmapStream<'_>` and `Avc444BitmapStream<'_>` - `QuantQuality`, `Point`, `Color` `ironrdp-egfx` was the only Core-Tier-by-behavior crate in the workspace without a dedicated fuzz target, leaving the Core Tier "must be fuzzed" invariant unsatisfied for graphics-pipeline DVC parsing. EGFX is parsed both client-side (server-sent frames, capability acks) and server-side (client-sent capability acks, frame acks); the new target exercises both paths since it operates at the PDU layer. Changes: - Add `ironrdp-egfx` path dependency to `ironrdp-fuzzing/Cargo.toml` - Add `egfx_pdu_decode` oracle function - Add `fuzz/fuzz_targets/egfx_pdu_decoding.rs` - Register the new bin in `fuzz/Cargo.toml` - Regenerate `fuzz/Cargo.lock` and root `Cargo.lock` Verification: - `cargo xtask check fmt | lints | locks | typos | tests` all pass - `cargo check --manifest-path fuzz/Cargo.toml` builds the new target - Net diff: +46 lines across 5 files plus 1 new file
1 parent df0bf9c commit 962182a

6 files changed

Lines changed: 53 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ironrdp-fuzzing/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ironrdp-rdpdr.path = "../ironrdp-rdpdr"
1919
ironrdp-rdpsnd.path = "../ironrdp-rdpsnd"
2020
ironrdp-cliprdr-format.path = "../ironrdp-cliprdr-format"
2121
ironrdp-displaycontrol.path = "../ironrdp-displaycontrol"
22+
ironrdp-egfx.path = "../ironrdp-egfx"
2223
ironrdp-svc.path = "../ironrdp-svc"
2324

2425
[lints]

crates/ironrdp-fuzzing/src/oracles/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,29 @@
1212
1313
use crate::generators::BitmapInput;
1414

15+
/// Decodes EGFX (MS-RDPEGFX) PDUs from the given bytes.
16+
///
17+
/// Exercises the `GfxPdu` umbrella decoder plus the individually-decodable
18+
/// sub-PDU and bitmap-stream types in `ironrdp-egfx`. Catches panics, sanitizer
19+
/// findings, and any other runtime failures the decoder may produce on
20+
/// attacker-controlled input. Matches the byte-stream oracle pattern used by
21+
/// `pdu_decode` and `channel_process`.
22+
pub fn egfx_pdu_decode(data: &[u8]) {
23+
use ironrdp_core::decode;
24+
use ironrdp_egfx::pdu::{
25+
Avc420BitmapStream, Avc444BitmapStream, CacheToSurfacePdu, CapabilitySet, Color, GfxPdu, Point, QuantQuality,
26+
};
27+
28+
let _ = decode::<GfxPdu>(data);
29+
let _ = decode::<CacheToSurfacePdu>(data);
30+
let _ = decode::<CapabilitySet>(data);
31+
let _ = decode::<Avc420BitmapStream<'_>>(data);
32+
let _ = decode::<Avc444BitmapStream<'_>>(data);
33+
let _ = decode::<QuantQuality>(data);
34+
let _ = decode::<Point>(data);
35+
let _ = decode::<Color>(data);
36+
}
37+
1538
pub fn pdu_decode(data: &[u8]) {
1639
use ironrdp_core::decode;
1740
use ironrdp_pdu::mcs::{ConnectInitial, ConnectResponse, McsMessage};

fuzz/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzz/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,10 @@ test = false
5555
doc = false
5656
bench = false
5757

58+
[[bin]]
59+
name = "egfx_pdu_decoding"
60+
path = "fuzz_targets/egfx_pdu_decoding.rs"
61+
test = false
62+
doc = false
63+
bench = false
64+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![no_main]
2+
3+
use libfuzzer_sys::fuzz_target;
4+
5+
fuzz_target!(|data: &[u8]| {
6+
ironrdp_fuzzing::oracles::egfx_pdu_decode(data);
7+
});

0 commit comments

Comments
 (0)