Skip to content

Commit

Permalink
test: regression test case for cliprdr_format target (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
CBenoit authored Mar 8, 2024
1 parent 220df04 commit e92d8c3
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 14 deletions.
4 changes: 2 additions & 2 deletions crates/ironrdp-cliprdr-format/src/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ impl BitmapInfoHeader {

let size = src.read_u32();

let width = src.read_i32();

// NOTE: .abs() could panic on i32::MIN, therefore we have a check for it first.

let width = src.read_i32();
check_invariant(width != i32::MIN && width.abs() <= 10_000)
.ok_or_else(|| invalid_message_err!("biWidth", "width is too big"))?;

Expand Down
Binary file not shown.
28 changes: 28 additions & 0 deletions crates/ironrdp-testsuite-core/tests/fuzz_regression.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
macro_rules! check {
($oracle:ident) => {{
use ironrdp_fuzzing::oracles;

const REGRESSION_DATA_FOLDER: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
concat!("/test_data/fuzz_regression/", stringify!($oracle))
);

println!("Read directory {REGRESSION_DATA_FOLDER}");
for entry in std::fs::read_dir(REGRESSION_DATA_FOLDER).unwrap() {
let entry = entry.unwrap();
println!("Check {}", entry.path().display());
let test_case = std::fs::read(entry.path()).unwrap();
oracles::$oracle(&test_case);
}
}};
}

#[test]
pub fn check_pdu_decode() {
check!(pdu_decode);
}

#[test]
pub fn check_cliprdr_format() {
check!(cliprdr_format);
}
1 change: 1 addition & 0 deletions crates/ironrdp-testsuite-core/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

mod clipboard;
mod displaycontrol;
mod fuzz_regression;
mod graphics;
mod input;
mod pcb;
Expand Down
1 change: 0 additions & 1 deletion crates/ironrdp-testsuite-core/tests/pdu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ mod input;
mod mcs;
mod pointer;
mod rdp;
mod regression;
mod rfx;
mod x224;
11 changes: 0 additions & 11 deletions crates/ironrdp-testsuite-core/tests/pdu/regression.rs

This file was deleted.

0 comments on commit e92d8c3

Please sign in to comment.