fix bug causing skipped mutation when part size is 0

This commit is contained in:
Alwin Berger 2024-08-15 09:38:52 +02:00
parent 72f9de45d0
commit 3b6cd3bc45

View File

@ -299,6 +299,10 @@ where
drop(other_testcase); drop(other_testcase);
let size = part.bytes().len(); let size = part.bytes().len();
if size == 0 { // Workaround for a bug where parts are empty. The origin remains unknown.
return Ok(MutationResult::Skipped);
}
let target = state.rand_mut().below(size); let target = state.rand_mut().below(size);
let range = rand_range(state, other_size, min(other_size, size - target)); let range = rand_range(state, other_size, min(other_size, size - target));