mirror of
https://github.com/str4d/rage.git
synced 2025-04-04 11:27:43 +03:00
fuzz: Update fuzzer targets for recent changes
This commit is contained in:
parent
5207877992
commit
81f91581bf
2 changed files with 5 additions and 3 deletions
|
@ -7,7 +7,7 @@ fuzz_target!(|data: &[u8]| {
|
||||||
if let Ok((leftover, stanza)) = read::age_stanza(data) {
|
if let Ok((leftover, stanza)) = read::age_stanza(data) {
|
||||||
let mut buf = Vec::with_capacity(data.len());
|
let mut buf = Vec::with_capacity(data.len());
|
||||||
gen(
|
gen(
|
||||||
write::age_stanza(stanza.tag, &stanza.args, &stanza.body),
|
write::age_stanza(stanza.tag, &stanza.args, &stanza.body()),
|
||||||
&mut buf,
|
&mut buf,
|
||||||
)
|
)
|
||||||
.expect("can write to Vec");
|
.expect("can write to Vec");
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
#![no_main]
|
#![no_main]
|
||||||
use libfuzzer_sys::fuzz_target;
|
use libfuzzer_sys::fuzz_target;
|
||||||
|
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
use age::Decryptor;
|
use age::Decryptor;
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| {
|
fuzz_target!(|data: &[u8]| {
|
||||||
if let Ok(decryptor) = Decryptor::new(data) {
|
if let Ok(decryptor) = Decryptor::new(data) {
|
||||||
match decryptor {
|
match decryptor {
|
||||||
Decryptor::Recipients(d) => {
|
Decryptor::Recipients(d) => {
|
||||||
let _ = d.decrypt(&[]);
|
let _ = d.decrypt(iter::empty());
|
||||||
}
|
}
|
||||||
// Don't pay the cost of scrypt while fuzzing.
|
// Don't pay the cost of scrypt while fuzzing.
|
||||||
Decryptor::Passphrase(_) => ()
|
Decryptor::Passphrase(_) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue