2019-04-06 19:02:31 +02:00
|
|
|
# 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 <fuzz>on : <cflags>-fsanitize=fuzzer <linkflags>-fsanitize=fuzzer ;
|
|
|
|
|
2019-04-30 09:08:03 +02:00
|
|
|
# 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 : <sanitize>off <debug-symbols>on <asserts>off <invariant-checks>off ;
|
|
|
|
|
2019-04-06 19:02:31 +02:00
|
|
|
project fuzzers
|
|
|
|
: requirements
|
|
|
|
<export-extra>on
|
|
|
|
<define>TORRENT_USE_ASSERTS=1
|
|
|
|
<define>TORRENT_USE_IPV6=1
|
|
|
|
<define>_SCL_SECURE=1
|
|
|
|
<define>_GLIBCXX_DEBUG
|
|
|
|
<cxxflags>-fno-omit-frame-pointer
|
|
|
|
<linkflags>-fno-omit-frame-pointer
|
|
|
|
<library>/torrent//torrent/
|
|
|
|
: default-build
|
|
|
|
<fuzz>on
|
|
|
|
<sanitize>on
|
|
|
|
<link>static
|
|
|
|
<variant>release
|
|
|
|
<debug-symbols>on
|
|
|
|
<debug-iterators>on
|
|
|
|
<export-extra>on
|
|
|
|
<asserts>on
|
|
|
|
<debug-symbols>on
|
|
|
|
;
|
|
|
|
|
|
|
|
local TARGETS ;
|
|
|
|
|
|
|
|
rule fuzzer ( name )
|
|
|
|
{
|
|
|
|
exe $(name) : src/$(name).cpp : <fuzz>off:<source>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 ;
|
2019-04-21 21:38:23 +02:00
|
|
|
fuzzer peer_conn ;
|
2019-04-06 19:02:31 +02:00
|
|
|
|
2019-04-25 11:02:11 +02:00
|
|
|
local LARGE_TARGETS =
|
|
|
|
torrent_info
|
|
|
|
lazy_bdecode
|
|
|
|
bdecode_node
|
|
|
|
http_parser
|
|
|
|
dht_node
|
|
|
|
utp
|
|
|
|
resume_data
|
|
|
|
file_storage_add_file
|
|
|
|
sanitize_path
|
2019-04-26 09:59:01 +02:00
|
|
|
upnp
|
2019-04-21 21:38:23 +02:00
|
|
|
peer_conn
|
2019-04-25 11:02:11 +02:00
|
|
|
;
|
|
|
|
|
2019-04-06 19:02:31 +02:00
|
|
|
install stage : $(TARGETS) : <install-type>EXE <location>fuzzers ;
|
2019-04-25 11:02:11 +02:00
|
|
|
install stage-large : $(LARGE_TARGETS) : <install-type>EXE <location>fuzzers ;
|
2019-04-06 19:02:31 +02:00
|
|
|
|
|
|
|
explicit stage ;
|
2019-04-25 11:02:11 +02:00
|
|
|
explicit stage-large ;
|
2019-04-06 19:02:31 +02:00
|
|
|
|