1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::FuzzTargetImpl;
use diem_proptest_helpers::ValueGenerator;
use move_binary_format::file_format::CompiledModule;
use proptest::prelude::*;
#[derive(Clone, Debug, Default)]
pub struct CompiledModuleTarget;
impl FuzzTargetImpl for CompiledModuleTarget {
fn description(&self) -> &'static str {
"VM CompiledModule (custom deserializer)"
}
fn generate(&self, _idx: usize, gen: &mut ValueGenerator) -> Option<Vec<u8>> {
let value = gen.generate(any_with::<CompiledModule>(16));
let mut out = vec![];
value
.serialize(&mut out)
.expect("serialization should work");
Some(out)
}
fn fuzz(&self, data: &[u8]) {
let _ = CompiledModule::deserialize(data);
}
}