feat: add fuzz_urb_uac target
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4ccae7bf37
commit
963c96cf8b
1 changed files with 21 additions and 0 deletions
21
lib/fuzz/fuzz_targets/fuzz_urb_uac.rs
Normal file
21
lib/fuzz/fuzz_targets/fuzz_urb_uac.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use std::sync::Arc;
|
||||
use usbip_rs::mock::MockSocket;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let rt = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
rt.block_on(async {
|
||||
let device = usbip_rs::uac::build_uac_loopback_device().unwrap();
|
||||
|
||||
let mock = MockSocket::new(data.to_vec());
|
||||
let output = mock.output_handle();
|
||||
let _ = usbip_rs::handle_urb_loop(mock, Arc::new(device)).await;
|
||||
let output_bytes = output.lock().unwrap();
|
||||
usbip_rs::fuzz_helpers::assert_usbip_responses_valid(&output_bytes);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue