summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-05-09 21:06:22 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-09 21:06:22 +0000
commit607f3cd63a314cd3a6c219b19cce31805b66cd6d (patch)
tree74c9bff427b4c8f4697ee28b17bbebe2be411cb2 /testing
parentd5d48457dabbe71e7f6b0baf2eaea6aa0dc86736 (diff)
downloadpdfium-607f3cd63a314cd3a6c219b19cce31805b66cd6d.tar.xz
Do not build GIF when codec is disabled
Currently all of the GIF related code is being built when support for the codec is disabled, it just isn't being utilized. Depending on the settings being used, this unneeded code may or may not get stripped during linking. This CL explicitly turns off building the GIF codec code if support for GIF is turned off. This also catches a few missed cases from previous CLs. BUG=pdfium:1080 Change-Id: Ie7fe2d894d2ae2f8f36ae05e0ff256f2ce6ef8d4 Reviewed-on: https://pdfium-review.googlesource.com/32330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'testing')
-rw-r--r--testing/libfuzzer/BUILD.gn32
-rw-r--r--testing/libfuzzer/xfa_codec_fuzzer.h21
2 files changed, 37 insertions, 16 deletions
diff --git a/testing/libfuzzer/BUILD.gn b/testing/libfuzzer/BUILD.gn
index 5a050a2237..1d17d3d4e7 100644
--- a/testing/libfuzzer/BUILD.gn
+++ b/testing/libfuzzer/BUILD.gn
@@ -40,13 +40,17 @@ group("libfuzzer") {
deps += [
":pdf_cfx_barcode_fuzzer",
":pdf_codec_bmp_fuzzer",
- ":pdf_codec_gif_fuzzer",
":pdf_codec_jpeg_fuzzer",
":pdf_css_fuzzer",
":pdf_fm2js_fuzzer",
":pdf_formcalc_fuzzer",
- ":pdf_lzw_fuzzer",
]
+ if (pdf_enable_xfa_gif) {
+ deps += [
+ ":pdf_codec_gif_fuzzer",
+ ":pdf_lzw_fuzzer",
+ ]
+ }
if (pdf_enable_xfa_png) {
deps += [ ":pdf_codec_png_fuzzer" ]
}
@@ -88,11 +92,19 @@ if (pdf_enable_xfa) {
]
}
- pdfium_fuzzer("pdf_codec_gif_fuzzer") {
- sources = [
- "pdf_codec_gif_fuzzer.cc",
- "xfa_codec_fuzzer.h",
- ]
+ if (pdf_enable_xfa_gif) {
+ pdfium_fuzzer("pdf_codec_gif_fuzzer") {
+ sources = [
+ "pdf_codec_gif_fuzzer.cc",
+ "xfa_codec_fuzzer.h",
+ ]
+ }
+
+ pdfium_fuzzer("pdf_lzw_fuzzer") {
+ sources = [
+ "pdf_lzw_fuzzer.cc",
+ ]
+ }
}
pdfium_fuzzer("pdf_codec_jpeg_fuzzer") {
@@ -137,12 +149,6 @@ if (pdf_enable_xfa) {
"pdf_formcalc_fuzzer.cc",
]
}
-
- pdfium_fuzzer("pdf_lzw_fuzzer") {
- sources = [
- "pdf_lzw_fuzzer.cc",
- ]
- }
}
pdfium_fuzzer("pdf_cmap_fuzzer") {
diff --git a/testing/libfuzzer/xfa_codec_fuzzer.h b/testing/libfuzzer/xfa_codec_fuzzer.h
index b1d888f380..483177e232 100644
--- a/testing/libfuzzer/xfa_codec_fuzzer.h
+++ b/testing/libfuzzer/xfa_codec_fuzzer.h
@@ -8,15 +8,24 @@
#include <memory>
#include "core/fxcodec/codec/ccodec_bmpmodule.h"
-#include "core/fxcodec/codec/ccodec_gifmodule.h"
-#include "core/fxcodec/codec/ccodec_pngmodule.h"
#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
-#include "core/fxcodec/codec/ccodec_tiffmodule.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "testing/fx_string_testhelpers.h"
#include "third_party/base/ptr_util.h"
+#ifdef PDF_ENABLE_XFA_GIF
+#include "core/fxcodec/codec/ccodec_gifmodule.h"
+#endif // PDF_ENABLE_XFA_GIF
+
+#ifdef PDF_ENABLE_XFA_PNG
+#include "core/fxcodec/codec/ccodec_pngmodule.h"
+#endif // PDF_ENABLE_XFA_PNG
+
+#ifdef PDF_ENABLE_XFA_TIFF
+#include "core/fxcodec/codec/ccodec_tiffmodule.h"
+#endif // PDF_ENABLE_XFA_TIFF
+
// Support up to 64 MB. This prevents trivial OOM when MSAN is on and
// time outs.
const int kXFACodecFuzzerPixelLimit = 64000000;
@@ -26,9 +35,15 @@ class XFACodecFuzzer {
static int Fuzz(const uint8_t* data, size_t size, FXCODEC_IMAGE_TYPE type) {
auto mgr = pdfium::MakeUnique<CCodec_ModuleMgr>();
mgr->SetBmpModule(pdfium::MakeUnique<CCodec_BmpModule>());
+#ifdef PDF_ENABLE_XFA_GIF
mgr->SetGifModule(pdfium::MakeUnique<CCodec_GifModule>());
+#endif // PDF_ENABLE_XFA_GIF
+#ifdef PDF_ENABLE_XFA_PNG
mgr->SetPngModule(pdfium::MakeUnique<CCodec_PngModule>());
+#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_TIFF
mgr->SetTiffModule(pdfium::MakeUnique<CCodec_TiffModule>());
+#endif // PDF_ENABLE_XFA_TIFF
std::unique_ptr<CCodec_ProgressiveDecoder> decoder =
mgr->CreateProgressiveDecoder();