]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Build the fuzzers without the libbindtest test library 12194/head
authorMichal Nowak <mnowak@isc.org>
Fri, 5 Jun 2026 10:08:03 +0000 (10:08 +0000)
committerMichal Nowak <mnowak@isc.org>
Mon, 8 Jun 2026 09:34:06 +0000 (11:34 +0200)
Every fuzz target depended on libtest_dep, which forces building the
libbindtest shared library.  In a static build (as used by OSS-Fuzz)
that link fails: libbindtest's netmgr wrappers multiply-define symbols
that also live in the static libisc/libns archives, and the static
system libraries are not position independent.

Only fuzz_dns_qp actually uses the qp test helpers, so give it just
tests/libtest/qp.c via the new libtest_qp_dep and drop libtest_dep
from the fuzzers.

Assisted-by: Claude:claude-opus-4-8
meson.build
tests/meson.build

index 0ca704177bae02c07745c267b8d55162d986bbf3..a3d05d9d2568c41df9e8bf5a18b0b3dccb84b392 100644 (file)
@@ -1873,6 +1873,13 @@ subdir('doc')
 subdir('tests')
 
 foreach name, sources : fuzz_binaries
+    # Only fuzz_dns_qp uses the qp test helpers; give it just those sources
+    # rather than the whole libbindtest library (see libtest_qp_dep).
+    fuzz_deps = [libdns_dep, libisc_dep]
+    if name == 'fuzz_dns_qp'
+        fuzz_deps += libtest_qp_dep
+    endif
+
     fuzz_bin = executable(
         name,
         sources,
@@ -1880,13 +1887,10 @@ foreach name, sources : fuzz_binaries
         implicit_include_directories: true,
         install: false,
         c_args: ['-Wno-vla'],
+        include_directories: test_inc,
         link_args: fuzz_link_args,
         sources: default_sanitize_options,
-        dependencies: [
-            libdns_dep,
-            libisc_dep,
-            libtest_dep,
-        ],
+        dependencies: fuzz_deps,
     )
 
     test(
index 416ba5125c44c3d8101a789fce4423a331bc839d..e62cf01de311b4b8fadff4b2cb655d8f80f47253 100644 (file)
@@ -39,6 +39,15 @@ libtest_dep = declare_dependency(
     include_directories: test_inc,
 )
 
+# Minimal dependency providing just the qp test helpers (compiled into the
+# consumer), for the fuzzers.  It avoids linking the whole libbindtest shared
+# library, which cannot be built from static archives - e.g. the OSS-Fuzz
+# build, where libbindtest's netmgr wrappers clash with libisc/libns.
+libtest_qp_dep = declare_dependency(
+    sources: files('libtest' / 'qp.c'),
+    include_directories: test_inc,
+)
+
 if not cmocka_dep.found()
     subdir_done()
 endif