Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full libfuzzer shimming (for cargo-fuzz libfuzzer alternative and other use cases) #981

Merged
merged 92 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
8568bb4
squash libfuzzer edits
addisoncrump May 4, 2023
1caf157
mergeup; make compat with libfuzzer-sys
addisoncrump May 9, 2023
8882d5e
fixup: compat with custom mutators
addisoncrump May 10, 2023
e95ff89
Merge branch 'main' of github.com:AFLplusplus/LibAFL into libfuzzer
addisoncrump May 10, 2023
2c5428a
use tui flag
addisoncrump May 10, 2023
8fd5474
add introspection support
addisoncrump May 10, 2023
3d2a4e9
use libfuzzer dep now that we've merged
addisoncrump May 12, 2023
016cadf
force input loading
addisoncrump Jun 6, 2023
2157790
some fixes
addisoncrump Jun 6, 2023
89ec678
mergeup
addisoncrump Jun 7, 2023
89ac90c
begin docs, impl shrink
addisoncrump Jun 7, 2023
629422b
make whole-archive conditional and not default
addisoncrump Jun 7, 2023
5286103
make more copies of counters maps
addisoncrump Jun 7, 2023
f652f77
lol, remember to add the observer
addisoncrump Jun 7, 2023
ce0be40
make size edge map observer an observer
addisoncrump Jun 7, 2023
a1d059d
fixup: make def of run driver conditional
addisoncrump Jun 8, 2023
856e969
add sanity checks for insertion
addisoncrump Jun 8, 2023
f87f2c4
revert silencing of forks
addisoncrump Jun 8, 2023
9d976e5
add experimental tmin support; add default asan flags
addisoncrump Jun 9, 2023
9d32627
Merge branch 'main' of github.com:AFLplusplus/LibAFL into libfuzzer
addisoncrump Jun 9, 2023
e51d3df
use default options instead of specifying our own
addisoncrump Jun 9, 2023
b750c3d
implement lockless mode
addisoncrump Jun 9, 2023
5711017
fix merge
addisoncrump Jun 9, 2023
ce33aad
fixup lockless corpus
addisoncrump Jun 10, 2023
807b1be
fixup for generalisation
addisoncrump Jun 10, 2023
25cc95b
Merge branch 'main' of github.com:AFLplusplus/LibAFL into libfuzzer
addisoncrump Jun 10, 2023
538f9fa
remove erroneous drop_in_place
addisoncrump Jun 14, 2023
ee12bd2
improve error logging in the case of corpus loading failure
addisoncrump Jun 14, 2023
874b426
ok, use lock files :pensive:
addisoncrump Jun 14, 2023
dc9cf00
fix tmin
addisoncrump Jun 16, 2023
f2778e1
implement merge (again); fix rare cases with maps being too small
addisoncrump Jun 16, 2023
580f8d0
implement a scheduler for removing excess
addisoncrump Jun 16, 2023
03afd7d
implement a walking strategy for corpus loading for large corpora
addisoncrump Jun 16, 2023
9f07169
revert filename parameter; rename and remove duplicates
addisoncrump Jun 17, 2023
0e742c7
Merge branch 'main' into libfuzzer
addisoncrump Jul 8, 2023
89735d1
various cleanup and clippy satisfaction
addisoncrump Jul 8, 2023
5a8c7c5
fix no_std tests
addisoncrump Jul 8, 2023
6d8e4ea
clang-format
addisoncrump Jul 8, 2023
4a06217
expand and satisfy the clippy gods
addisoncrump Jul 8, 2023
3af961a
fix sanitizer_ifaces bindgen for no_std
addisoncrump Jul 8, 2023
64facff
fix wasm fuzzer
addisoncrump Jul 8, 2023
9d2589d
fixup clippy script
addisoncrump Jul 14, 2023
f8a6142
rename and provide a small amount of explanation for sanitizer_interf…
addisoncrump Jul 14, 2023
86f29a9
mergeup
addisoncrump Jul 14, 2023
a45e04d
fixup: HasLastReportTime
addisoncrump Jul 15, 2023
3aad5e9
fix clippy oddities
addisoncrump Jul 20, 2023
5f6f8c9
restrict clippy checks to linux-only for libafl_libfuzzer_runtime
addisoncrump Jul 20, 2023
d3c32ce
Merge branch 'main' of github.com:AFLplusplus/LibAFL into libfuzzer
addisoncrump Jul 20, 2023
84a9d3a
Merge branch 'main' of github.com:AFLplusplus/LibAFL into libfuzzer
addisoncrump Aug 2, 2023
d4b0140
name the mutators
addisoncrump Aug 2, 2023
81f2020
format
addisoncrump Aug 2, 2023
067d7e4
fix clippy warning
addisoncrump Aug 2, 2023
7ed73a2
hope docker is fixed
addisoncrump Aug 2, 2023
bec635b
Merge branch 'main' into libfuzzer
domenukk Aug 2, 2023
51824bd
fix cmin lint
addisoncrump Aug 2, 2023
14287d0
clippy pass
domenukk Aug 2, 2023
80ba77a
more docs
domenukk Aug 2, 2023
e363c40
more clippy
domenukk Aug 2, 2023
a41cab1
Merge branch 'main' into libfuzzer
domenukk Aug 2, 2023
7c77e55
fix remaining clippy complaints
addisoncrump Aug 2, 2023
6b1c16c
fix import
addisoncrump Aug 2, 2023
381c834
miri fixes (no constructors executed)
addisoncrump Aug 2, 2023
537bd1a
exclude libafl_libfuzzer from cargo-hack
addisoncrump Aug 2, 2023
29fa6de
fix clippy check for sanitizer_interfaces
addisoncrump Aug 2, 2023
e23c81b
fmt
addisoncrump Aug 2, 2023
74f3c02
fix CI (?)
domenukk Aug 2, 2023
89143dd
Merge branch 'main' into libfuzzer
domenukk Aug 2, 2023
11165cf
Merge branch 'main' into libfuzzer
domenukk Aug 3, 2023
37a2175
Merge branch 'main' into libfuzzer
domenukk Aug 3, 2023
fd3bc07
deduplicate sancov 8bit for improved perf on ASAN
addisoncrump Aug 9, 2023
aaff794
merge 8bit coverage regions + comment out insane deduplication
addisoncrump Aug 9, 2023
368815c
no erroring out on free hooks
addisoncrump Aug 9, 2023
d49d8fc
fixup for non-forking merge
addisoncrump Aug 9, 2023
476200d
skip the corpus dir if we use it
addisoncrump Aug 9, 2023
6f0c7be
Merge branch 'main' of github.com:AFLplusplus/LibAFL into libfuzzer
addisoncrump Aug 22, 2023
d05916c
fixup: recent libafl changes and feature flags
addisoncrump Aug 22, 2023
69ace6c
libafl_libfuzzer: use rust-lld for whole-archive feature
Mrmaxmeier Aug 12, 2023
3e0118f
clarify cause of failure
addisoncrump Aug 22, 2023
dbea434
mark unsafe
addisoncrump Aug 22, 2023
ae4686c
clippy :cursed_cowboy:
addisoncrump Aug 22, 2023
d5b39e8
attempt to fix wasm
addisoncrump Aug 22, 2023
cf0e1ef
spooky unknowable bug :ghost:
addisoncrump Aug 22, 2023
ebe961d
more clippy lints
addisoncrump Aug 22, 2023
0122a03
clippy fix for merge
addisoncrump Aug 22, 2023
f6d225c
use the version pin
addisoncrump Aug 22, 2023
d5d654e
Merge branch 'main' into libfuzzer
domenukk Aug 23, 2023
b7e2752
add unsafe to ::register
domenukk Aug 23, 2023
9020704
Serdeany autoreg fix
domenukk Aug 23, 2023
ff23e2b
make type assert actionable
domenukk Aug 23, 2023
672137c
miri fixes
addisoncrump Aug 23, 2023
49718c8
Merge branch 'main' into libfuzzer
domenukk Aug 24, 2023
aefcb82
Merge branch 'main' into libfuzzer
domenukk Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
with:
profile: minimal
toolchain: stable
components: llvm-tools
- name: Install and cache deps
uses: awalsh128/cache-apt-pkgs-action@v1.1.0
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ perf.data.old
.vscode
test.dict

.idea/

# Ignore all built fuzzers
fuzzer_*
AFLplusplus
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"libafl_concolic/test/runtime_test",
"libafl_derive",
"libafl_frida",
"libafl_libfuzzer",
"libafl_nyx",
"libafl_qemu",
"libafl_sugar",
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ COPY scripts/dummy.rs libafl_nyx/src/lib.rs
COPY libafl_tinyinst/Cargo.toml libafl_tinyinst/
COPY scripts/dummy.rs libafl_tinyinst/src/lib.rs

# avoid pulling in the runtime, as this is quite an expensive build, until later
COPY libafl_libfuzzer/Cargo.toml libafl_libfuzzer/
COPY scripts/dummy.rs libafl_libfuzzer/src/lib.rs

COPY utils utils

RUN cargo build && cargo build --release
Expand Down Expand Up @@ -117,6 +121,10 @@ COPY libafl_concolic/symcc_runtime libafl_concolic/symcc_runtime
COPY libafl_concolic/test libafl_concolic/test
COPY libafl_nyx/src libafl_nyx/src
RUN touch libafl_nyx/src/lib.rs
COPY libafl_libfuzzer/src libafl_libfuzzer/src
COPY libafl_libfuzzer/libafl_libfuzzer_runtime libafl_libfuzzer/libafl_libfuzzer_runtime
COPY libafl_libfuzzer/build.rs libafl_libfuzzer/build.rs
RUN touch libafl_libfuzzer/src/lib.rs
RUN cargo build && cargo build --release

# Copy fuzzers over
Expand Down
4 changes: 3 additions & 1 deletion fuzzers/baby_fuzzer_wasm/pkg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
],
"module": "baby_fuzzer_wasm.js",
"types": "baby_fuzzer_wasm.d.ts",
"sideEffects": false
"sideEffects": [
"./snippets/*"
]
}
10 changes: 8 additions & 2 deletions fuzzers/baby_fuzzer_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use libafl::{
corpus::{Corpus, InMemoryCorpus},
events::SimpleEventManager,
executors::{ExitKind, InProcessExecutor},
feedbacks::{CrashFeedback, MaxMapFeedback},
feedbacks::{CrashFeedback, MapFeedbackMetadata, MaxMapFeedback},
generators::RandPrintablesGenerator,
inputs::{BytesInput, HasTargetBytes},
monitors::SimpleMonitor,
Expand All @@ -15,7 +15,9 @@ use libafl::{
state::{HasSolutions, StdState},
Fuzzer, StdFuzzer,
};
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
use libafl_bolts::{
current_nanos, rands::StdRand, serdeany::RegistryBuilder, tuples::tuple_list, AsSlice,
};
use wasm_bindgen::prelude::*;
use web_sys::{Performance, Window};

Expand All @@ -37,6 +39,10 @@ pub extern "C" fn external_current_millis() -> u64 {
pub fn fuzz() {
set_panic_hook();

unsafe {
RegistryBuilder::register::<MapFeedbackMetadata<u8>>();
}

let mut signals = [0u8; 64];
let signals_ptr = signals.as_mut_ptr();
let signals_set = |i: usize| unsafe {
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/fuzzbench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use nix::{self, unistd::dup};
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

let res = match Command::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/fuzzbench_fork_qemu/src/fuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use nix::{self, unistd::dup};
pub fn main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

let res = match Command::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/fuzzbench_qemu/src/fuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub const MAX_INPUT_SIZE: usize = 1048576; // 1MB
pub fn main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

let res = match Command::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/fuzzbench_text/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use nix::{self, unistd::dup};
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

let res = match Command::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libafl_atheris/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub extern "C" fn LLVMFuzzerRunDriver(
) {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

assert!(harness_fn.is_some(), "No harness callback provided");
let harness_fn = harness_fn.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libmozjpeg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern "C" {
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, EDGES_MAP,
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_accounting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct Opt {
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }
let opt = Opt::parse();

let broker_port = opt.broker_port;
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_centralized/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub extern "C" fn libafl_main() {

// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }
let opt = Opt::parse();

let broker_port = opt.broker_port;
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_cmin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, std_edges_m
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_ctx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct Opt {
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }
let opt = Opt::parse();

let broker_port = opt.broker_port;
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_launcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct Opt {
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }
let opt = Opt::parse();

let broker_port = opt.broker_port;
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_norestart/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct Opt {
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }
let opt = Opt::parse();

let broker_port = opt.broker_port;
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_tcp_manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, EDGES_MAP,
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_reachability/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern "C" {
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_stb_image/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use libafl_targets::{
pub fn main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_stb_image_concolic/fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct Opt {
pub fn main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

let opt = Opt::parse();

Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_stb_image_sugar/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input};
pub fn main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/nautilus_sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct Opt {
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }
let opt = Opt::parse();

let broker_port = opt.broker_port;
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/tutorial/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use metadata::{PacketLenFeedback, PacketLenMinimizerScheduler};
pub extern "C" fn libafl_main() {
// Registry the metadata types used in this fuzzer
// Needed only on no_std
//RegistryBuilder::register::<Tokens>();
// unsafe { RegistryBuilder::register::<Tokens>(); }

println!(
"Workdir: {:?}",
Expand Down
34 changes: 32 additions & 2 deletions libafl/src/corpus/cached.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! The [`CachedOnDiskCorpus`] stores [`Testcase`]s to disk, keeping a subset of them in memory/cache, evicting in a FIFO manner.

use alloc::collections::vec_deque::VecDeque;
use alloc::{collections::vec_deque::VecDeque, string::String};
use core::cell::RefCell;
use std::path::Path;

Expand Down Expand Up @@ -193,7 +193,7 @@ where
pub fn with_meta_format<P>(
dir_path: P,
cache_max_len: usize,
meta_format: OnDiskMetadataFormat,
meta_format: Option<OnDiskMetadataFormat>,
domenukk marked this conversation as resolved.
Show resolved Hide resolved
) -> Result<Self, Error>
where
P: AsRef<Path>,
Expand All @@ -204,6 +204,31 @@ where
)
}

/// Creates the [`CachedOnDiskCorpus`] specifying the metadata format and the prefix to prepend
/// to each testcase.
///
/// Will error, if [`std::fs::create_dir_all()`] failed for `dir_path`.
pub fn with_meta_format_and_prefix<P>(
dir_path: P,
cache_max_len: usize,
meta_format: Option<OnDiskMetadataFormat>,
prefix: Option<String>,
locking: bool,
) -> Result<Self, Error>
where
P: AsRef<Path>,
{
Self::_new(
InMemoryOnDiskCorpus::with_meta_format_and_prefix(
dir_path,
meta_format,
prefix,
locking,
)?,
cache_max_len,
)
}

/// Internal constructor `fn`
fn _new(on_disk_corpus: InMemoryOnDiskCorpus<I>, cache_max_len: usize) -> Result<Self, Error> {
if cache_max_len == 0 {
Expand All @@ -217,6 +242,11 @@ where
cache_max_len,
})
}

/// Fetch the inner corpus
pub fn inner(&self) -> &InMemoryOnDiskCorpus<I> {
&self.inner
}
}

/// ``CachedOnDiskCorpus`` Python bindings
Expand Down
Loading