• Home
Name Date Size #Lines LOC

..--

libpsl_fuzzer.in/12-May-2024-2319

libpsl_icu_fuzzer.in/12-May-2024-8581

libpsl_icu_load_dafsa_fuzzer.in/12-May-2024-109

libpsl_icu_load_fuzzer.in/12-May-2024-35,97132,992

libpsl_icu_load_fuzzer.repro/12-May-2024-

libpsl_idn2_fuzzer.in/12-May-2024-8480

libpsl_idn2_fuzzer.repro/12-May-2024-

libpsl_idn2_load_dafsa_fuzzer.in/12-May-2024-109

libpsl_idn2_load_fuzzer.in/12-May-2024-2,7922,302

libpsl_idn_fuzzer.in/12-May-2024-8379

libpsl_idn_load_dafsa_fuzzer.in/12-May-2024-109

libpsl_idn_load_fuzzer.in/12-May-2024-17,08116,013

libpsl_load_dafsa_fuzzer.in/12-May-2024-109

libpsl_load_fuzzer.in/12-May-2024-12,15011,267

Makefile.amD12-May-20242.7 KiB8977

README.mdD12-May-20242.1 KiB7552

coverage.shD12-May-202458 63

fuzzer.hD12-May-20241.4 KiB3911

get_all_corporaD12-May-2024617 1912

get_ossfuzz_corporaD12-May-20241.4 KiB4617

libpsl_fuzzer.cD12-May-20243 KiB10460

libpsl_icu_load_fuzzer.dictD12-May-2024302 109

libpsl_idn2_load_fuzzer.dictD12-May-2024302 109

libpsl_idn_load_fuzzer.dictD12-May-2024302 109

libpsl_load_dafsa_fuzzer.cD12-May-20242.1 KiB7737

libpsl_load_fuzzer.cD12-May-20241.9 KiB6530

libpsl_load_fuzzer.dictD12-May-2024302 109

main.cD12-May-20243.7 KiB163102

meson.buildD12-May-2024712 2523

run-afl.shD12-May-20242 KiB6834

run-clang.shD12-May-20242.3 KiB7742

view-coverage.shD12-May-2024780 2212

README.md

1# Fuzzers
2
3These are fuzzers designed for use with `libFuzzer` or `afl`. They can
4be used to run on Google's OSS-Fuzz (https://github.com/google/oss-fuzz/).
5
6The convention used here is that the initial values for each parser fuzzer
7are taken from the $NAME.in directory.
8
9Crash reproducers from OSS-Fuzz are put into $NAME.repro directory for
10regression testing with top dir 'make check' or 'make check-valgrind'.
11
12The ./configure runs below are for libidn2.
13To test libicu replace 'libidn2' with 'libicu', to test with
14libidn replace 'libidn2' by 'libidn'.
15
16
17# Running a fuzzer using clang
18
19Use the following commands on top dir:
20```
21export CC=clang-5.0
22export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp"
23./configure --enable-static --disable-gtk-doc --enable-runtime=libidn2 --enable-builtin=libidn2
24make clean
25make -j$(nproc)
26cd fuzz
27
28# build and run libpsl_fuzzer
29./run-clang.sh libpsl_fuzzer
30```
31
32
33# Running a fuzzer using AFL
34
35Use the following commands on top dir:
36
37```
38$ CC=afl-clang-fast ./configure --disable-gtk-doc --enable-runtime=libidn2 --enable-builtin=libidn2
39$ make -j$(nproc) clean all
40$ cd fuzz
41$ ./run-afl.sh libpsl_fuzzer
42```
43
44# Fuzz code coverage using the corpus directories *.in/
45
46Code coverage reports currently work best with gcc+lcov+genhtml.
47
48In the top directory:
49```
50CC=gcc CFLAGS="-O0 -g" ./configure --disable-gtk-doc --enable-runtime=libidn2 --enable-builtin=libidn2
51make fuzz-coverage
52xdg-open lcov/index.html
53```
54
55Each fuzzer target has it's own functions to cover, e.g.
56`libpsl_fuzzer` covers psl_is_public_suffix.
57
58To work on corpora for better coverage, `cd fuzz` and use e.g.
59`./view-coverage.sh libpsl_fuzzer`.
60
61
62# Enhancing the testsuite for issues found
63
64Each reproducer file should be dropped into the appropriate *.repro/
65directory.
66
67
68# Clang CFI instrumentation
69```
70CC=clang-5.0 CFLAGS="-B/usr/bin/gold -O0 -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-trap=all" ./configure
71make clean
72make
73make check
74```
75