From d4101a671c7e3ee078953c80e744207d45969a2f Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Fri, 12 Jul 2024 13:04:49 +0200 Subject: [PATCH] Make language clearer (#2383) --- libafl/src/mutators/token_mutations.rs | 2 +- libafl/src/observers/map/mod.rs | 24 +++++++++++----------- libafl_frida/src/coverage_rt.rs | 2 +- libafl_qemu/libafl_qemu_build/src/build.rs | 2 +- utils/libafl_fmt/src/main.rs | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libafl/src/mutators/token_mutations.rs b/libafl/src/mutators/token_mutations.rs index 186d1f59b1..95480dd09e 100644 --- a/libafl/src/mutators/token_mutations.rs +++ b/libafl/src/mutators/token_mutations.rs @@ -83,7 +83,7 @@ impl Tokens { let mut head = 0; loop { if head >= size { - // Sanity Check + // Make double sure this is not completely off assert!(head == size); break; } diff --git a/libafl/src/observers/map/mod.rs b/libafl/src/observers/map/mod.rs index 4030a71b23..3c06b4ebaa 100644 --- a/libafl/src/observers/map/mod.rs +++ b/libafl/src/observers/map/mod.rs @@ -243,11 +243,11 @@ pub mod macros { #[macro_export] macro_rules! require_index_tracking { ($name: literal, $obs: ident) => { - struct SanityCheck { + struct TrackingEnabledCheck { phantom: ::core::marker::PhantomData, } - impl SanityCheck { + impl TrackingEnabledCheck { #[rustfmt::skip] const MESSAGE: &'static str = { const LINE_OFFSET: usize = line!().ilog10() as usize + 2; @@ -263,7 +263,7 @@ pub mod macros { SPACING, "| ", ) }; - const TRACKING_SANITY: bool = { + const TRACKING_ENABLED: bool = { if !O::INDICES { panic!("{}", Self::MESSAGE) } else { @@ -272,13 +272,13 @@ pub mod macros { }; #[inline(always)] - fn check_sanity() { - if !Self::TRACKING_SANITY { + fn check_enabled() { + if !Self::TRACKING_ENABLED { unreachable!("{}", Self::MESSAGE); } } } - SanityCheck::<$obs>::check_sanity(); // check that tracking is enabled for this map + TrackingEnabledCheck::<$obs>::check_enabled(); // check that tracking is enabled for this map }; } @@ -306,11 +306,11 @@ pub mod macros { #[macro_export] macro_rules! require_novelties_tracking { ($name: literal, $obs: ident) => { - struct SanityCheck { + struct TrackingEnabledCheck { phantom: ::core::marker::PhantomData, } - impl SanityCheck { + impl TrackingEnabledCheck { #[rustfmt::skip] const MESSAGE: &'static str = { const LINE_OFFSET: usize = line!().ilog10() as usize + 2; @@ -327,7 +327,7 @@ pub mod macros { SPACING, "| ", ) }; - const TRACKING_SANITY: bool = { + const TRACKING_ENABLED: bool = { if !O::NOVELTIES { panic!("{}", Self::MESSAGE) } else { @@ -336,13 +336,13 @@ pub mod macros { }; #[inline(always)] - fn check_sanity() { - if !Self::TRACKING_SANITY { + fn check_enabled() { + if !Self::TRACKING_ENABLED { unreachable!("{}", Self::MESSAGE); } } } - SanityCheck::<$obs>::check_sanity(); // check that tracking is enabled for this map + TrackingEnabledCheck::<$obs>::check_enabled(); // check that tracking is enabled for this map }; } } diff --git a/libafl_frida/src/coverage_rt.rs b/libafl_frida/src/coverage_rt.rs index 971d2ee64d..60a058e060 100644 --- a/libafl_frida/src/coverage_rt.rs +++ b/libafl_frida/src/coverage_rt.rs @@ -202,7 +202,7 @@ impl CoverageRuntime { // // Since we also need to spill some registers in order to update our // coverage map, in the event of a long branch, we can simply re-use - // these spilt registers. This, however, means we need to retard the + // these spilt registers. This, however, means we need to reset the // code writer so that we can overwrite the so-called "restoration // prologue". #[cfg(target_arch = "aarch64")] diff --git a/libafl_qemu/libafl_qemu_build/src/build.rs b/libafl_qemu/libafl_qemu_build/src/build.rs index 51df79739a..125f05db8a 100644 --- a/libafl_qemu/libafl_qemu_build/src/build.rs +++ b/libafl_qemu/libafl_qemu_build/src/build.rs @@ -430,7 +430,7 @@ pub fn build( ); } - assert!(output_lib.is_file()); // Sanity check + assert!(output_lib.is_file()); // Make sure this isn't very very wrong /* let mut objects = vec![]; diff --git a/utils/libafl_fmt/src/main.rs b/utils/libafl_fmt/src/main.rs index 942c60b39b..60d835705a 100644 --- a/utils/libafl_fmt/src/main.rs +++ b/utils/libafl_fmt/src/main.rs @@ -78,7 +78,7 @@ use walkdir::{DirEntry, WalkDir}; use which::which; async fn run_cargo_fmt(path: PathBuf, is_check: bool, verbose: bool) -> io::Result<()> { - // Sanity Check + // Make sure we parse the correct file assert_eq!(path.file_name().unwrap().to_str().unwrap(), "Cargo.toml"); let task_str = if is_check { "Checking" } else { "Formatting" };