From 4eba9323c5162a1a1ae8b23ef2e8cfc9d2575cd1 Mon Sep 17 00:00:00 2001 From: Dongjia Zhang Date: Tue, 17 May 2022 22:06:38 +0900 Subject: [PATCH] Fix overflow in Frida mode (#635) --- libafl/src/bolts/cli.rs | 6 +++--- libafl_frida/src/coverage_rt.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libafl/src/bolts/cli.rs b/libafl/src/bolts/cli.rs index 55081e62b4..e8dadb3e7a 100644 --- a/libafl/src/bolts/cli.rs +++ b/libafl/src/bolts/cli.rs @@ -135,7 +135,7 @@ pub struct FuzzerOptions { /// cores. 'none' to run a client without binding to any core. /// ex: '1,2-4,6' selects the cores 1, 2, 3, 4, and 6. #[cfg(feature = "frida_cli")] - #[clap(short, long, default_value = "0", parse(try_from_str = Cores::from_cmdline), help_heading = "ASAN Options")] + #[clap(long, default_value = "0", parse(try_from_str = Cores::from_cmdline), help_heading = "ASAN Options")] pub asan_cores: Cores, /// number of fuzz iterations to perform @@ -181,7 +181,7 @@ pub struct FuzzerOptions { /// cores. 'none' to run a client without binding to any core. /// ex: '1,2-4,6' selects the cores 1, 2, 3, 4, and 6. #[cfg(feature = "frida_cli")] - #[clap(short, long, default_value = "0", parse(try_from_str = Cores::from_cmdline), help_heading = "Frida Options")] + #[clap(long, default_value = "0", parse(try_from_str = Cores::from_cmdline), help_heading = "Frida Options")] pub cmplog_cores: Cores, /// enable ASAN leak detection @@ -278,7 +278,7 @@ pub struct FuzzerOptions { /// Spawn a client in each of the provided cores. Use 'all' to select all available /// cores. 'none' to run a client without binding to any core. /// ex: '1,2-4,6' selects the cores 1, 2, 3, 4, and 6. - #[clap(short, long, default_value = "0", parse(try_from_str = Cores::from_cmdline))] + #[clap(long, default_value = "0", parse(try_from_str = Cores::from_cmdline))] pub cores: Cores, /// port on which the broker should listen diff --git a/libafl_frida/src/coverage_rt.rs b/libafl_frida/src/coverage_rt.rs index dc9ae2d932..a83c429d84 100644 --- a/libafl_frida/src/coverage_rt.rs +++ b/libafl_frida/src/coverage_rt.rs @@ -158,9 +158,9 @@ impl CoverageRuntime { let bitflip = 0x1cad21f72c81017c ^ 0xdb979082e96dd4de; let mut h64 = tmp ^ bitflip; h64 = h64.rotate_left(49) & h64.rotate_left(24); - h64 *= 0x9FB21C651E98DF25; + h64 = h64.wrapping_mul(0x9FB21C651E98DF25); h64 ^= (h64 >> 35) + 8; - h64 *= 0x9FB21C651E98DF25; + h64 = h64.wrapping_mul(0x9FB21C651E98DF25); h64 ^= h64 >> 28; let writer = output.writer();