Skip to content

Conversation

henryhchchc
Copy link
Contributor

@henryhchchc henryhchchc commented Aug 25, 2025

Description

Prior to this fix, the CachedOnDiskCorpus will load the input to the test case when it was get from the corpus. However, this is not the correct timing to load the input for the test case, as there is another function load_input_into for that.

Some schedulers (e.g., WeightedScheduler) will traverse all the test cases in the corpus to compute the score (using only their metadata). This will made all the input being loaded from the disk even though they are not needed. In this case, the fuzzer will be bounded by the disk I/O for loading the inputs from the disk.

for i in state.corpus().ids() {
let mut testcase = state.corpus().get(i)?.borrow_mut();
let weight = F::compute(state, &mut *testcase)?;
weights.insert(i, weight);
sum += weight;
}

In this PR, CachedOnDiskCorpus is made to cache the input only when load_input_into is called.

Checklist

  • I have run ./scripts/precommit.sh and addressed all comments

./scripts/precommit.sh reported errors in the crates I didn't touch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant