Don't let fuzz targets import arbitrary directly (#4806)
The version of the `arbitrary` crate used in fuzz targets needs to be the same as the version used in `libfuzzer-sys`. That's why the latter crate re-exports the former. But we need to make sure to consistently use the re-exported version. That's most easily done if that's the only version we have available. However, `fuzz/Cargo.toml` declared a direct dependency on `arbitrary`, making it available for import, and leading to that version being used in a couple places. There were two copies of `arbitrary` built before, even though they were the same version: one with the `derive` feature turned on, through the direct dependency, and one with it turned off when imported through `libfuzzer-sys`. So I haven't specifically tested this but fuzzer builds might be slightly faster now. I have not removed the build-dep on `arbitrary`, because `build.rs` is not invoked by libFuzzer and so it doesn't matter what version of `arbitrary` it uses. Our other crates, like `cranelift-fuzzgen` and `wasmtime-fuzzing`, can still accidentally use a different version of `arbitrary` than the fuzz targets which rely on them. This commit only fixes the direct cases within `fuzz/**`.
This commit is contained in:
@@ -121,15 +121,15 @@ mod component {
|
||||
|
||||
let module = quote! {
|
||||
#[allow(unused_imports)]
|
||||
fn static_component_api_target(input: &mut arbitrary::Unstructured) -> arbitrary::Result<()> {
|
||||
fn static_component_api_target(input: &mut libfuzzer_sys::arbitrary::Unstructured) -> libfuzzer_sys::arbitrary::Result<()> {
|
||||
use anyhow::Result;
|
||||
use arbitrary::{Unstructured, Arbitrary};
|
||||
use component_test_util::{self, Float32, Float64};
|
||||
use component_fuzz_util::Declarations;
|
||||
use component_test_util::{self, Float32, Float64};
|
||||
use libfuzzer_sys::arbitrary::{self, Arbitrary};
|
||||
use std::borrow::Cow;
|
||||
use std::sync::{Arc, Once};
|
||||
use wasmtime::component::{ComponentType, Lift, Lower};
|
||||
use wasmtime_fuzzing::generators::component_types;
|
||||
use std::borrow::Cow;
|
||||
|
||||
const SEED: u64 = #seed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user