Skip to content

Commit 3a2d091

Browse files
committed
deps: Bump arbitrary to 1.0; libfuzzer-sys to 0.4
1 parent 9d909aa commit 3a2d091

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

crates/wasm-smith/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ name = "corpus"
2020
harness = false
2121

2222
[dependencies]
23-
arbitrary = { version = "0.4.6", features = ["derive"] }
23+
arbitrary = { version = "1.0.0", features = ["derive"] }
2424
leb128 = "0.2.4"
2525
structopt = { version = "0.3.16", optional = true }
2626
wasm-encoder = { version = "0.4.0", path = "../wasm-encoder" }
2727
indexmap = "1.6"
2828

2929
[dev-dependencies]
3030
criterion = "0.3.3"
31-
libfuzzer-sys = "0.3.4"
31+
libfuzzer-sys = "0.4.0"
3232
rand = { version = "0.7.3", features = ["small_rng"] }
3333
wasmparser = { path = "../wasmparser" }
3434
wasmprinter = { path = "../wasmprinter" }

crates/wasm-smith/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use arbitrary::{Arbitrary, Result, Unstructured};
1515
/// Every trait method has a provided default implementation, so that you only
1616
/// need to override the methods for things you want to change away from the
1717
/// default.
18-
pub trait Config: Arbitrary + Default + Clone {
18+
pub trait Config: for<'a> Arbitrary<'a> + Default + Clone {
1919
/// The minimum number of types to generate. Defaults to 0.
2020
fn min_types(&self) -> usize {
2121
0
@@ -309,8 +309,8 @@ pub struct SwarmConfig {
309309
max_nesting_depth: usize,
310310
}
311311

312-
impl Arbitrary for SwarmConfig {
313-
fn arbitrary(u: &mut Unstructured<'_>) -> Result<Self> {
312+
impl<'a> Arbitrary<'a> for SwarmConfig {
313+
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
314314
const MAX_MAXIMUM: usize = 1000;
315315

316316
let reference_types_enabled: bool = u.arbitrary()?;

crates/wasm-smith/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ impl<C: Config> ConfiguredModule<C> {
204204
}
205205
}
206206

207-
impl<C: Config> Arbitrary for ConfiguredModule<C> {
208-
fn arbitrary(u: &mut Unstructured) -> Result<Self> {
207+
impl<'a, C: Config> Arbitrary<'a> for ConfiguredModule<C> {
208+
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
209209
let mut module = ConfiguredModule::<C>::default();
210210
module.build(u, false)?;
211211
Ok(module)
@@ -228,8 +228,8 @@ impl MaybeInvalidModule {
228228
}
229229
}
230230

231-
impl Arbitrary for MaybeInvalidModule {
232-
fn arbitrary(u: &mut Unstructured) -> Result<Self> {
231+
impl<'a> Arbitrary<'a> for MaybeInvalidModule {
232+
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
233233
let mut module = Module::default();
234234
module.inner.build(u, true)?;
235235
Ok(MaybeInvalidModule { module })
@@ -1954,12 +1954,12 @@ fn limited_string(max_size: usize, u: &mut Unstructured) -> Result<String> {
19541954
let size = std::cmp::min(size, max_size);
19551955
match str::from_utf8(&u.peek_bytes(size).unwrap()) {
19561956
Ok(s) => {
1957-
u.get_bytes(size).unwrap();
1957+
u.bytes(size).unwrap();
19581958
Ok(s.into())
19591959
}
19601960
Err(e) => {
19611961
let i = e.valid_up_to();
1962-
let valid = u.get_bytes(i).unwrap();
1962+
let valid = u.bytes(i).unwrap();
19631963
let s = unsafe {
19641964
debug_assert!(str::from_utf8(valid).is_ok());
19651965
str::from_utf8_unchecked(valid)
@@ -2029,7 +2029,7 @@ fn unique_import_strings(
20292029

20302030
fn arbitrary_vec_u8(u: &mut Unstructured) -> Result<Vec<u8>> {
20312031
let size = u.arbitrary_len::<u8>()?;
2032-
Ok(u.get_bytes(size)?.to_vec())
2032+
Ok(u.bytes(size)?.to_vec())
20332033
}
20342034

20352035
impl EntityType {

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cargo-fuzz = true
99

1010
[dependencies]
1111
env_logger = "0.8"
12-
libfuzzer-sys = "0.3.2"
12+
libfuzzer-sys = "0.4.0"
1313
log = "0.4"
1414
tempfile = "3.0"
1515
wasm-smith = { path = "../crates/wasm-smith" }

0 commit comments

Comments
 (0)