From f5cc3541029a08c6d48cc8dbef517d1cf615fb79 Mon Sep 17 00:00:00 2001 From: Mrmaxmeier <3913977+Mrmaxmeier@users.noreply.github.com> Date: Fri, 14 Oct 2022 13:03:57 +0200 Subject: [PATCH] Token mutations: set MutationResult for CmpValues::Bytes (#838) * token mutations: set MutationResult for CmpValues::Bytes I haven't measured this and am not even sure if CmpValues::Bytes is currently populated by any executor, but this seems like an oversight. * replace dead zlib-1.2.12.tar.gz URL See https://zlib.net/fossils/OBSOLETE --- fuzzers/frida_libpng/README.md | 2 +- fuzzers/qemu_arm_launcher/Makefile.toml | 4 +++- libafl/src/mutators/token_mutations.rs | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fuzzers/frida_libpng/README.md b/fuzzers/frida_libpng/README.md index b4dd9d93d8..bda901473d 100644 --- a/fuzzers/frida_libpng/README.md +++ b/fuzzers/frida_libpng/README.md @@ -38,7 +38,7 @@ You can also fuzz libpng-1.6.37 on windows with frida mode ### To build it with visual studio 1. Install clang for windows (make sure you add LLVM to the system path!) [https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.1](https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.1) -2. Download libpng-1.6.37[https://deac-fra.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.xz] and zlib [https://zlib.net/zlib-1.2.11.tar.gz] into this directory, and rename `zlib-1.2.11` directory to `zlib`. +2. Download libpng-1.6.37[https://deac-fra.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.xz] and zlib [https://zlib.net/fossils/zlib-1.2.11.tar.gz] into this directory, and rename `zlib-1.2.11` directory to `zlib`. 3. Build libpng1.6.37 - Open libpng-1.6.37/projects/vstudio/vstudio.sln diff --git a/fuzzers/qemu_arm_launcher/Makefile.toml b/fuzzers/qemu_arm_launcher/Makefile.toml index 51b98678d1..dcbef5c7d3 100644 --- a/fuzzers/qemu_arm_launcher/Makefile.toml +++ b/fuzzers/qemu_arm_launcher/Makefile.toml @@ -20,8 +20,10 @@ windows_alias = "unsupported" [tasks.zlib_unix_wget] condition = { files_not_exist = [ "./zlib-1.2.12" ] } script_runner="@shell" +# NOTE: There's no specific reason we're using an old version of zlib, +# but newer versions get moved to fossils/ after a while. script=''' -wget http://www.zlib.net/zlib-1.2.12.tar.gz +wget https://zlib.net/fossils/zlib-1.2.12.tar.gz tar -xvf zlib-1.2.12.tar.gz ''' diff --git a/libafl/src/mutators/token_mutations.rs b/libafl/src/mutators/token_mutations.rs index 77f1e95c0e..448ad68639 100644 --- a/libafl/src/mutators/token_mutations.rs +++ b/libafl/src/mutators/token_mutations.rs @@ -567,6 +567,7 @@ where while size != 0 { if v.0[0..size] == input.bytes()[i..i + size] { buffer_copy(input.bytes_mut(), &v.1, 0, i, size); + result = MutationResult::Mutated; break 'outer; } size -= 1; @@ -575,6 +576,7 @@ where while size != 0 { if v.1[0..size] == input.bytes()[i..i + size] { buffer_copy(input.bytes_mut(), &v.0, 0, i, size); + result = MutationResult::Mutated; break 'outer; } size -= 1; @@ -583,8 +585,6 @@ where } } - //println!("{:?}", result); - Ok(result) } }