Resolve pull request comments: refactoring and workflow
This commit is contained in:
6
.github/workflows/cargo_fmt.yml
vendored
6
.github/workflows/cargo_fmt.yml
vendored
@@ -43,6 +43,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
command: fmt
|
command: fmt
|
||||||
args: --manifest-path libraries/cbor/Cargo.toml --all -- --check
|
args: --manifest-path libraries/cbor/Cargo.toml --all -- --check
|
||||||
|
|
||||||
|
- name: Cargo format libraries/cbor/fuzz
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --manifest-path libraries/cbor/fuzz/Cargo.toml --all -- --check
|
||||||
|
|
||||||
- name: Cargo format libraries/crypto
|
- name: Cargo format libraries/crypto
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ path = ".."
|
|||||||
members = ["."]
|
members = ["."]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "fuzz_target_1"
|
name = "fuzz_target_cbor"
|
||||||
path = "fuzz_targets/fuzz_target_1.rs"
|
path = "fuzz_targets/fuzz_target_cbor.rs"
|
||||||
test = false
|
test = false
|
||||||
doc = false
|
doc = false
|
||||||
|
|||||||
@@ -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