From be3d1d588f8c53cb94ae5c723da1f7a11baf8e19 Mon Sep 17 00:00:00 2001 From: Tobias Scharnowski Date: Mon, 4 Jul 2022 16:37:36 +0200 Subject: [PATCH] Make ByteNegMutator negate, not flip (#675) Change the ByteNegMutator to negate a byte, not flip it. Flipping a byte is already implemented in ByteFlipMutator. See issue: https://github.com/AFLplusplus/LibAFL/issues/674 --- libafl/src/mutators/mutations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libafl/src/mutators/mutations.rs b/libafl/src/mutators/mutations.rs index 8b63e8f4d9..cf3a9c04c3 100644 --- a/libafl/src/mutators/mutations.rs +++ b/libafl/src/mutators/mutations.rs @@ -271,7 +271,7 @@ where Ok(MutationResult::Skipped) } else { let byte = state.rand_mut().choose(input.bytes_mut()); - *byte = !*byte; + *byte = (-(*byte as i16)) as u8; Ok(MutationResult::Mutated) } }