Updated Fuzzing your nim code to rabbit out all the hard bugs (markdown)
This commit is contained in:
parent
dcd1e6d8f6
commit
6f7a03894a
|
@ -48,7 +48,9 @@ This is a pretty contrived thing, but just imagine this being somewhere in a fil
|
||||||
|
|
||||||
Save that example in a file called "afl.nim". Because afl needs to instrument the generated binary code, you need to tell nim to use the compiler frontend afl comes with, instead of whatever your distro defaults to. Create a file called "afl.nim.cfg" in the same directory and put this in:
|
Save that example in a file called "afl.nim". Because afl needs to instrument the generated binary code, you need to tell nim to use the compiler frontend afl comes with, instead of whatever your distro defaults to. Create a file called "afl.nim.cfg" in the same directory and put this in:
|
||||||
|
|
||||||
```
|
```ini
|
||||||
|
# nim.cfg for afl-clang
|
||||||
|
-d:noSignalHandler
|
||||||
cc = clang
|
cc = clang
|
||||||
clang.exe = "afl-clang"
|
clang.exe = "afl-clang"
|
||||||
clang.linkerexe = "afl-clang"
|
clang.linkerexe = "afl-clang"
|
||||||
|
@ -59,6 +61,16 @@ This is a working example for OSX, where afl was installed via homebrew. To make
|
||||||
|
|
||||||
Very important: `-d:noSignalHandler`, because AFL installs it's own signal handler inside instrumented code.
|
Very important: `-d:noSignalHandler`, because AFL installs it's own signal handler inside instrumented code.
|
||||||
|
|
||||||
|
```ini
|
||||||
|
# nim.cfg for afl-gcc
|
||||||
|
-d:noSignalHandler
|
||||||
|
cc = gcc
|
||||||
|
gcc.exe = "afl-gcc"
|
||||||
|
gcc.linkerexe = "afl-gcc"
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a working example for Linux. AFL was installed globally with 'apt-get install afl'
|
||||||
|
|
||||||
```
|
```
|
||||||
$ nim c -d:noSignalHandler afl
|
$ nim c -d:noSignalHandler afl
|
||||||
```
|
```
|
||||||
|
@ -114,3 +126,4 @@ trace = 0x10f913050"Traceback (most recent call last)\10"
|
||||||
You can limit the exceptions that are considered crashes by adjusting the except: clause in the example.
|
You can limit the exceptions that are considered crashes by adjusting the except: clause in the example.
|
||||||
|
|
||||||
Then I'd strongly suggest to start reading up on afl if you want to employ it with confidence.
|
Then I'd strongly suggest to start reading up on afl if you want to employ it with confidence.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue