rage/fuzz/fuzz_targets/decrypt_buffered.rs
Jack Grigg 7ef416aaa3 age: Add Decryptor::new_buffered
This is significantly more efficient than `Decryptor::new` at parsing
headers, due to avoiding repeated short reads.
2023-03-25 00:05:56 +00:00

18 lines
425 B
Rust

#![no_main]
use libfuzzer_sys::fuzz_target;
use std::iter;
use age::Decryptor;
fuzz_target!(|data: &[u8]| {
if let Ok(decryptor) = Decryptor::new_buffered(data) {
match decryptor {
Decryptor::Recipients(d) => {
let _ = d.decrypt(iter::empty());
}
// Don't pay the cost of scrypt while fuzzing.
Decryptor::Passphrase(_) => (),
}
}
});