parent
30f8fd44ef
commit
62291654bd
@ -9,7 +9,8 @@ It has been tested on Linux.
|
||||
To build this example, run `cargo build --release` in this folder.
|
||||
This will call (the build.rs)[./build.rs], which in turn downloads a libpng archive from the web.
|
||||
Then, it will link (the fuzzer)[./src/fuzzer.rs] against (the C++ harness)[./harness.cc] and the instrumented `libpng`.
|
||||
Afterwards, the fuzzer will be ready to run, from `target/frida_libpng`.
|
||||
Afterwards, the fuzzer will be ready to run, from `target/frida_libpng`.
|
||||
On unix platforms, you'll need [libc++](https://libcxx.llvm.org/) to build it.
|
||||
|
||||
### Build For Android
|
||||
When building for android using a cross-compiler, make sure you have a _standalone toolchain_, and then add the following:
|
||||
@ -30,7 +31,7 @@ After building the libpng-harness, too, you can run `find . -name libpng-harness
|
||||
`./target/release/frida_libpng ./libpng-harness.so LLVMFuzzerTestOneInput ./libpng-harness.so --cores=0`
|
||||
|
||||
## Windows
|
||||
You can also fuzz libpng-1.6.37 on windows with frida mode!
|
||||
You can also fuzz libpng-1.6.37 on windows with frida mode! (still experimental, we have an issue on frida-gum.)
|
||||
|
||||
### To build it with visual studio
|
||||
1. Install clang for windows (make sure you add LLVM to the system path!)
|
||||
@ -62,43 +63,3 @@ clang++ -L.\zlib.dll .\harness.o .\libpng16.lib -lzlib -shared -o .\libpng-harne
|
||||
./frida_libpng.exe ./libpng-harness.dll LLVMFuzzerTestOneInput ./libpng-harness.dll --cores=0
|
||||
```
|
||||
|
||||
### To build it with msys2
|
||||
1. Install and setup msys2 (https://www.msys2.org/)
|
||||
2. (Optional) If you prefer to compile libpng with clang, you can install it and its dependecy with
|
||||
```
|
||||
pacman -S mingw-w64-x86_64-clang
|
||||
pacman -S mingw-w64-clang-x86_64-zlib
|
||||
```
|
||||
and
|
||||
```
|
||||
export LDFLAGS='-L/clang64/lib'
|
||||
export CPPFLAGS='-I/clang64/include'
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
```
|
||||
3. Compile frida_libpng (possibly from your powershell)
|
||||
```
|
||||
cargo build --release
|
||||
cp ./target/release/frida_libpng.exe .
|
||||
```
|
||||
4. Compile libpng-1.6.37 with the following commands
|
||||
```
|
||||
cd libpng-1.6.37
|
||||
./configure --enable-hardware-optimizations=yes --with-pic=yes
|
||||
make
|
||||
cd ..
|
||||
```
|
||||
5. Compile the harness with gcc or clang++
|
||||
```
|
||||
g++ -O3 -c -I./libpng-1.6.37 -fPIC harness.cc -o harness.o
|
||||
g++ -O3 harness.o ./libpng-1.6.37/.libs/libpng16.a -static -shared -lz -o libpng-harness.dll
|
||||
```
|
||||
or
|
||||
```
|
||||
clang++ -O3 -c -I./libpng-1.6.37 -fPIC harness.cc -o harness.o
|
||||
clang++ -O3 harness.o ./libpng-1.6.37/.libs/libpng16.a -static -shared -lz -o libpng-harness.dll
|
||||
```
|
||||
6. Run the fuzzer
|
||||
```
|
||||
./frida_libpng.exe ./libpng-harness.dll LLVMFuzzerTestOneInput ./libpng-harness.dll --cores=0
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user