Resolve pull request comments: refactoring and workflow
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
#![no_main]
|
||||
#[macro_use]
|
||||
extern crate libfuzzer_sys;
|
||||
extern crate cbor;
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let encoded = cbor::read(data);
|
||||
match encoded{
|
||||
Ok(value) => {
|
||||
let mut decoded = Vec::new();
|
||||
let _ = cbor::write(value, &mut decoded);
|
||||
assert_eq!(decoded, data);
|
||||
}
|
||||
Err(_) => {}
|
||||
};
|
||||
});
|
||||
|
||||
18
libraries/cbor/fuzz/fuzz_targets/fuzz_target_cbor.rs
Normal file
18
libraries/cbor/fuzz/fuzz_targets/fuzz_target_cbor.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
#![no_main]
|
||||
#[macro_use]
|
||||
extern crate libfuzzer_sys;
|
||||
extern crate alloc;
|
||||
extern crate cbor;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let encoded = cbor::read(data);
|
||||
if let Ok(value) = encoded {
|
||||
let mut decoded = Vec::new();
|
||||
let result = cbor::write(value, &mut decoded);
|
||||
assert!(result);
|
||||
assert_eq!(decoded, data);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user