Skip to content

Commit

Permalink
Token mutations: set MutationResult for CmpValues::Bytes (#838)
Browse files Browse the repository at this point in the history
* 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

Former-commit-id: f5cc3541029a08c6d48cc8dbef517d1cf615fb79
  • Loading branch information
Mrmaxmeier authored Oct 14, 2022
1 parent 6e208c5 commit 4925078
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fuzzers/frida_libpng/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion fuzzers/qemu_arm_launcher/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''

Expand Down
4 changes: 2 additions & 2 deletions libafl/src/mutators/token_mutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -583,8 +585,6 @@ where
}
}

//println!("{:?}", result);

Ok(result)
}
}
Expand Down

0 comments on commit 4925078

Please sign in to comment.