The fuzzer generates (configurable) random input strings and sends them to command line programs, monitoring their output and exit codes.
If you're using WSL on Windows to work on the assignment, make sure that Git does not replace the Unix line endings with CRLF. You can configure git to preserve the line endings from the remote repository:
git config --local core.autocrlf input
git config --local core.safecrlf true
Line ending normalization for text files is already enabled via .gitattributes.
If you're still getting errors caused by the line endings, you can try the following (after configuring Git as outlined above):
git add --update --renormalize
git checkout .
If that doesn't work, you can also exclicity convert all text files to use Unix line endings:
sudo apt-get install dos2unix
find . -type f -not -path "./.git/*" -exec dos2unix {} \;
git commit -a -m 'Convert line endings dos2unix'
gcc program_unsafe.c -o program_unsafe -Wno-deprecated-declarations
java Fuzzer.java "./program_unsafe"
gcc program_coverage.c -o program_coverage --coverage
This yields a file program_coverage.gcno
.
java Fuzzer.java "./program_coverage"
This yields a file program_coverage.gcda
Line coverage:
gcov program_coverage.c
Branch coverage:
gcov -b program_coverage.c
In both cases, the coverage report is then available in file program_coverage.c.gcov
.