From 7d9a359f51fca167dce488a1039dded7096c7ac5 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 18 Aug 2022 19:03:08 +0200 Subject: [PATCH] Make the subtract lazy in the icache fuzz target (#4732) This unchecked, always-performed subtract *could* be the cause of #4731, if the immediate was 0 in the first place. --- fuzz/fuzz_targets/cranelift-icache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzz/fuzz_targets/cranelift-icache.rs b/fuzz/fuzz_targets/cranelift-icache.rs index 1c6959a78a..abc3800e83 100644 --- a/fuzz/fuzz_targets/cranelift-icache.rs +++ b/fuzz/fuzz_targets/cranelift-icache.rs @@ -96,7 +96,7 @@ fuzz_target!(|func: SingleFunction| { let imm = imm.bits(); cursor.func.dfg[inst] = ir::InstructionData::UnaryImm { opcode: ir::Opcode::Iconst, - imm: Imm64::new(imm.checked_add(1).unwrap_or(imm - 1)), + imm: Imm64::new(imm.checked_add(1).unwrap_or_else(|| imm - 1)), }; } else { cursor.func.dfg[inst] = ir::InstructionData::UnaryImm {