# to fuzz libtorrent, you need a recent version of clang. # if you have a favourite component to fuzz, you can run that specific binary # without specifying the "-runs=" argument, it's probably a good idea to seed # the fuzzing with the included corpus though import feature : feature ; use-project /torrent : .. ; feature fuzz : off external on : composite propagated link-incompatible ; feature.compose on : -fsanitize=fuzzer -fsanitize=fuzzer ; feature sanitize : off on : composite propagated link-incompatible ; feature.compose on : norecover norecover ; # this is a build configuration that only does limited validation (i.e. no # sanitizers, invariant-checks, asserts etc.). The purpose is to quickly iterate # on inputs to build code coverage variant build_coverage : release : off on off off ; project fuzzers : requirements on TORRENT_USE_ASSERTS=1 TORRENT_USE_IPV6=1 _SCL_SECURE=1 _GLIBCXX_DEBUG -fno-omit-frame-pointer -fno-omit-frame-pointer /torrent//torrent/ : default-build on on static release on on on on on ; local TARGETS ; rule fuzzer ( name ) { exe $(name) : src/$(name).cpp : off:main.cpp ; TARGETS += $(name) ; } fuzzer torrent_info ; fuzzer parse_magnet_uri ; fuzzer bdecode_node ; fuzzer lazy_bdecode ; fuzzer parse_int ; fuzzer sanitize_path ; fuzzer escape_path ; fuzzer file_storage_add_file ; fuzzer base32decode ; fuzzer base32encode ; fuzzer base64encode ; fuzzer escape_string ; fuzzer gzip ; fuzzer verify_encoding ; fuzzer convert_to_native ; fuzzer convert_from_native ; fuzzer utf8_wchar ; fuzzer wchar_utf8 ; fuzzer utf8_codepoint ; fuzzer http_parser ; fuzzer upnp ; fuzzer dht_node ; fuzzer utp ; fuzzer resume_data ; fuzzer peer_conn ; local LARGE_TARGETS = torrent_info lazy_bdecode bdecode_node http_parser dht_node utp resume_data file_storage_add_file sanitize_path upnp peer_conn ; install stage : $(TARGETS) : EXE fuzzers ; install stage-large : $(LARGE_TARGETS) : EXE fuzzers ; explicit stage ; explicit stage-large ;