Skip to content

Commit ac728a8

Browse files
committed
Update AFL tests
1 parent c182e41 commit ac728a8

File tree

4 files changed

+11
-30
lines changed

4 files changed

+11
-30
lines changed

sailfish-tests/fuzzing-tests/Cargo.lock

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

sailfish-tests/fuzzing-tests/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ publish = false
99

1010
[dependencies]
1111
afl = "0.8.0"
12-
sailfish = { path = "../../sailfish" }
13-
sailfish-compiler = { path = "../../sailfish-compiler" }
12+
sailfish = { path = "../../sailfish", default-features = false }
13+
sailfish-compiler = { path = "../../sailfish-compiler", default-features = false }

sailfish-tests/fuzzing-tests/src/bin/compiler.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ use sailfish_compiler::Compiler;
55

66
fn main() {
77
fuzz!(|data: &[u8]| {
8-
// HTML escaping
9-
if let Ok(feed) = std::str::from_utf8(data) {
10-
let compiler = Compiler::default();
11-
let _ = compiler.compile_str(feed);
12-
}
8+
let compiler = Compiler::default();
9+
let feed = data.iter().map(|&b| char::from(b)).collect::<String>();
10+
let _ = compiler.compile_str(&*feed);
1311
});
1412
}

sailfish-tests/fuzzing-tests/src/bin/escape.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ use sf::Render;
77
fn main() {
88
fuzz!(|data: &[u8]| {
99
// HTML escaping
10-
if let Ok(feed) = std::str::from_utf8(data) {
11-
let mut buf = sf::Buffer::new();
12-
let _ = feed.render_escaped(&mut buf);
13-
}
10+
let mut buf = sf::Buffer::new();
11+
let feed = data.iter().map(|&b| char::from(b)).collect::<String>();
12+
let _ = feed.render_escaped(&mut buf);
1413
});
1514
}

0 commit comments

Comments
 (0)