diff --git a/foyer-memory/fuzz/Cargo.toml b/foyer-memory/fuzz/Cargo.toml index da46b5ee..206453d6 100644 --- a/foyer-memory/fuzz/Cargo.toml +++ b/foyer-memory/fuzz/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] ahash = "0.8" +arbitrary = { version = "1", features = ["derive"] } foyer-memory = { path = ".." } foyer-workspace-hack = { version = "0.4", path = "../../foyer-workspace-hack" } libfuzzer-sys = "0.4" -arbitrary = { version = "1", features = ["derive"] } [package.metadata] cargo-fuzz = true diff --git a/foyer-memory/fuzz/fuzz_targets/cache_fuzz.rs b/foyer-memory/fuzz/fuzz_targets/cache_fuzz.rs index daf9988e..f3c47405 100644 --- a/foyer-memory/fuzz/fuzz_targets/cache_fuzz.rs +++ b/foyer-memory/fuzz/fuzz_targets/cache_fuzz.rs @@ -1,3 +1,17 @@ +// Copyright 2024 Foyer Project Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #![no_main] use std::sync::Arc; @@ -115,7 +129,7 @@ fuzz_target!(|data: Input| { for op in data.operations { match op { Op::Insert(k, v, size) => { - cache.insert(k, v, size as usize); + cache.insert(k, v, size); } Op::Get(k) => { let _ = cache.get(&k);