shithub: dav1d

Download patch

ref: e74daebe090a104a5a87cdb5550cf4b706451b6c
parent: 5ff8504394d815fd27f86b6c4030d58d9836c258
author: Janne Grunau <[email protected]>
date: Fri Oct 26 06:15:37 EDT 2018

libfuzzer: build oss-fuzz fuzzer binaries with meson

oss-fuzz's FuzzingEngine requires libc++.

--- a/tests/meson.build
+++ b/tests/meson.build
@@ -87,19 +87,22 @@
 endif
 
 dav1d_fuzzer_sources =  files('libfuzzer/dav1d_fuzzer.c')
-fuzzer_flags = []
+fuzzer_ldflags = []
 
 if fuzzing_engine == 'none'
     dav1d_fuzzer_sources += files('libfuzzer/main.c')
 elif fuzzing_engine == 'libfuzzer'
-    fuzzer_flags += ['-fsanitize=fuzzer']
+    fuzzer_ldflags += ['-fsanitize=fuzzer']
+elif fuzzing_engine == 'oss-fuzz'
+    # libFuzzingEngine needs libc++
+    fuzzer_ldflags += ['-lFuzzingEngine', '-lc++']
 endif
 
 dav1d_fuzzer = executable('dav1d_fuzzer',
     dav1d_fuzzer_sources,
     include_directories: dav1d_inc_dirs,
-    c_args: [stackalign_flag, stackrealign_flag] + fuzzer_flags,
-    link_args: fuzzer_flags,
+    c_args: [stackalign_flag, stackrealign_flag],
+    link_args: fuzzer_ldflags,
     link_with : libdav1d,
     build_by_default: true,
     dependencies : [thread_dependency],
@@ -108,9 +111,8 @@
 dav1d_fuzzer_mt = executable('dav1d_fuzzer_mt',
     dav1d_fuzzer_sources,
     include_directories: dav1d_inc_dirs,
-    c_args: [stackalign_flag, stackrealign_flag] + fuzzer_flags +
-            ['-DDAV1D_MT_FUZZING'],
-    link_args: fuzzer_flags,
+    c_args: [stackalign_flag, stackrealign_flag, '-DDAV1D_MT_FUZZING'],
+    link_args: fuzzer_ldflags,
     link_with : libdav1d,
     build_by_default: true,
     dependencies : [thread_dependency],