Files
cuprate-for-explorer/fuzz/fuzz_targets/levin_codec.rs
Boog900 1b28c3b728 Add Fuzzing + fix found issues (#464)
* add fuzz tests

* fix CI

* fix found vuln

* fix deny

* add more targets

* fmt + clippy

* Add exclude for fuzz

* add defaults rather than exclude

* add fuzz to CI

* remove clippy run

* add readme

* review fixes

* Update Cargo.toml

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>

---------

Co-authored-by: hinto-janai <hinto.janai@protonmail.com>
2025-05-28 20:29:06 +01:00

22 lines
508 B
Rust

#![no_main]
use bytes::{BufMut, BytesMut};
use libfuzzer_sys::fuzz_target;
use tokio_util::codec::Decoder;
use cuprate_levin::BucketHead;
use cuprate_wire::{LevinCommand, MoneroWireCodec};
fuzz_target!(|data: Vec<(BucketHead<LevinCommand>, Vec<u8>)>| {
let mut codec = MoneroWireCodec::default();
for (bucket, body) in data {
let mut bytes = BytesMut::new();
bucket.write_bytes_into(&mut bytes);
bytes.put_slice(&body);
drop(codec.decode(&mut bytes));
}
});