Remove unneeded loop in SpliceMutator::mutate
(#1471)
previously we searched for the first and the last difference between exactly the same 2 inputs 3 times in a loop Co-authored-by: Andrea Fioraldi <andreafioraldi@gmail.com>
This commit is contained in:
parent
7d2c854b71
commit
f3a4f4f664
@ -1282,18 +1282,13 @@ where
|
|||||||
let mut other_testcase = state.corpus().get(idx)?.borrow_mut();
|
let mut other_testcase = state.corpus().get(idx)?.borrow_mut();
|
||||||
let other = other_testcase.load_input(state.corpus())?;
|
let other = other_testcase.load_input(state.corpus())?;
|
||||||
|
|
||||||
let mut counter: u32 = 0;
|
|
||||||
loop {
|
|
||||||
let (f, l) = locate_diffs(input.bytes(), other.bytes());
|
let (f, l) = locate_diffs(input.bytes(), other.bytes());
|
||||||
|
|
||||||
if f != l && f >= 0 && l >= 2 {
|
if f != l && f >= 0 && l >= 2 {
|
||||||
break (f as u64, l as u64);
|
(f as u64, l as u64)
|
||||||
}
|
} else {
|
||||||
if counter == 3 {
|
|
||||||
return Ok(MutationResult::Skipped);
|
return Ok(MutationResult::Skipped);
|
||||||
}
|
}
|
||||||
counter += 1;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let split_at = state.rand_mut().between(first_diff, last_diff) as usize;
|
let split_at = state.rand_mut().between(first_diff, last_diff) as usize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user