Update AFL tests

This commit is contained in:
Kogia-sima 2020-12-16 23:15:22 +09:00
parent c182e41622
commit ac728a8495
4 changed files with 11 additions and 30 deletions

View File

@ -62,7 +62,7 @@ dependencies = [
[[package]]
name = "fuzzing-tests"
version = "0.2.1"
version = "0.2.3"
dependencies = [
"afl",
"sailfish",
@ -99,12 +99,6 @@ version = "0.2.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701"
[[package]]
name = "linked-hash-map"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a"
[[package]]
name = "memchr"
version = "2.3.3"
@ -146,7 +140,7 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "sailfish"
version = "0.2.1"
version = "0.2.3"
dependencies = [
"itoap",
"ryu",
@ -155,14 +149,13 @@ dependencies = [
[[package]]
name = "sailfish-compiler"
version = "0.2.1"
version = "0.2.3"
dependencies = [
"home",
"memchr",
"proc-macro2",
"quote",
"syn",
"yaml-rust",
]
[[package]]
@ -257,12 +250,3 @@ name = "xdg"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
[[package]]
name = "yaml-rust"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d"
dependencies = [
"linked-hash-map",
]

View File

@ -9,5 +9,5 @@ publish = false
[dependencies]
afl = "0.8.0"
sailfish = { path = "../../sailfish" }
sailfish-compiler = { path = "../../sailfish-compiler" }
sailfish = { path = "../../sailfish", default-features = false }
sailfish-compiler = { path = "../../sailfish-compiler", default-features = false }

View File

@ -5,10 +5,8 @@ use sailfish_compiler::Compiler;
fn main() {
fuzz!(|data: &[u8]| {
// HTML escaping
if let Ok(feed) = std::str::from_utf8(data) {
let compiler = Compiler::default();
let _ = compiler.compile_str(feed);
}
let compiler = Compiler::default();
let feed = data.iter().map(|&b| char::from(b)).collect::<String>();
let _ = compiler.compile_str(&*feed);
});
}

View File

@ -7,9 +7,8 @@ use sf::Render;
fn main() {
fuzz!(|data: &[u8]| {
// HTML escaping
if let Ok(feed) = std::str::from_utf8(data) {
let mut buf = sf::Buffer::new();
let _ = feed.render_escaped(&mut buf);
}
let mut buf = sf::Buffer::new();
let feed = data.iter().map(|&b| char::from(b)).collect::<String>();
let _ = feed.render_escaped(&mut buf);
});
}