From 8dc38b40c10321a6858b000c3d0b7d90e4540dca Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 11 Oct 2018 05:20:54 +0000 Subject: Fix double V8 initialization with fuzzers. Commit 95860d7 added some new fuzzers, but they try to use both the generic fuzzer's initialization code, as well as their own custom initialization code. Add a new "pdfium_public_fuzzer" GN template for these new fuzzers, so they use their own initialization code rather than the generic one. BUG=chromium:894053 TBR=tsepez@chromium.org Change-Id: I6110a199e1c64d7c0632f9966e146fd316b757ae Reviewed-on: https://pdfium-review.googlesource.com/c/43832 Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- testing/fuzzers/BUILD.gn | 55 ++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/testing/fuzzers/BUILD.gn b/testing/fuzzers/BUILD.gn index 5a6af69f69..f528ad5c9d 100644 --- a/testing/fuzzers/BUILD.gn +++ b/testing/fuzzers/BUILD.gn @@ -65,11 +65,40 @@ group("fuzzers") { } } +template("pdfium_public_fuzzer") { + source_set(target_name) { + sources = invoker.sources + [ + "pdfium_fuzzer_helper.cc", + "pdfium_fuzzer_helper.h", + ] + deps = [ + "../../:pdfium", + "../../:test_support", + ] + if (defined(invoker.deps)) { + deps += invoker.deps + } + testonly = true + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ + "//build/config/compiler:no_chromium_code", + ":fuzzer_config", + ] + if (pdf_enable_v8) { + configs += [ "//v8:external_startup_data" ] + deps += [ + "//v8", + "//v8:v8_libplatform", + ] + } + } +} + template("pdfium_fuzzer") { source_set(target_name) { sources = invoker.sources + [ "pdf_fuzzer_init.cc" ] deps = [ - "../..:pdfium", + "../../:pdfium", ] if (defined(invoker.deps)) { deps += invoker.deps @@ -181,17 +210,10 @@ if (pdf_enable_xfa) { ] } - pdfium_fuzzer("pdfium_xfa_fuzzer_src") { + pdfium_public_fuzzer("pdfium_xfa_fuzzer_src") { sources = [ - "pdfium_fuzzer_helper.cc", - "pdfium_fuzzer_helper.h", "pdfium_xfa_fuzzer.cc", ] - deps = [ - "../../:test_support", - "//v8", - "//v8:v8_libplatform", - ] } } @@ -270,21 +292,8 @@ pdfium_fuzzer("pdf_xml_fuzzer_src") { ] } -pdfium_fuzzer("pdfium_fuzzer_src") { +pdfium_public_fuzzer("pdfium_fuzzer_src") { sources = [ "pdfium_fuzzer.cc", - "pdfium_fuzzer_helper.cc", - "pdfium_fuzzer_helper.h", ] - - deps = [ - "../../:test_support", - ] - - if (pdf_enable_v8) { - deps += [ - "//v8", - "//v8:v8_libplatform", - ] - } } -- cgit v1.2.3