test/fuzzer: a simple fuzzer using libFuzzer

This commit adds some basic infrastructure for fuzzers, and adds a
fuzzer for the CUE sheet parser.
This commit is contained in:
Max Kellermann
2020-10-05 19:46:18 +02:00
parent 8358b34efa
commit dffd5831f8
4 changed files with 48 additions and 0 deletions
+12
View File
@@ -112,6 +112,13 @@ if get_option('buildtype') != 'debug'
]
endif
if get_option('fuzzer')
fuzzer_flags = ['-fsanitize=fuzzer,address,undefined']
add_global_arguments(fuzzer_flags, language: 'cpp')
add_global_arguments(fuzzer_flags, language: 'c')
add_global_link_arguments(fuzzer_flags, language: 'cpp')
endif
add_global_arguments(common_cxxflags + compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
add_global_arguments(common_cflags + c_compiler.get_supported_arguments(test_cflags), language: 'c')
add_global_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp')
@@ -502,6 +509,7 @@ mpd = build_target(
chromaprint_dep,
],
link_args: link_args,
build_by_default: not get_option('fuzzer'),
install: not is_android and not is_haiku,
)
@@ -542,3 +550,7 @@ subdir('doc')
if get_option('test')
subdir('test')
endif
if get_option('fuzzer')
subdir('test/fuzzer')
endif