summaryrefslogtreecommitdiff
path: root/testing/libfuzzer
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-05-10 16:38:15 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-10 16:38:15 +0000
commit95061379c9453b941783398826acff674d2bbfd7 (patch)
tree766885c5e74724ca6120562f6b8a5f57b99a4794 /testing/libfuzzer
parent35557c3ce83cc6e26f07cf5d5c520ee6afd39a67 (diff)
downloadpdfium-95061379c9453b941783398826acff674d2bbfd7.tar.xz
Do not build BMP when codec is disabled
Currently all of the BMP 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 BMP codec code if support for BMP is turned off. BUG=pdfium:1080 Change-Id: I56d40639a5a3631f9c601a1eef3f98873feac94f Reviewed-on: https://pdfium-review.googlesource.com/32370 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'testing/libfuzzer')
-rw-r--r--testing/libfuzzer/BUILD.gn16
-rw-r--r--testing/libfuzzer/xfa_codec_fuzzer.h7
2 files changed, 16 insertions, 7 deletions
diff --git a/testing/libfuzzer/BUILD.gn b/testing/libfuzzer/BUILD.gn
index 1d17d3d4e7..2b2c19389b 100644
--- a/testing/libfuzzer/BUILD.gn
+++ b/testing/libfuzzer/BUILD.gn
@@ -39,12 +39,14 @@ group("libfuzzer") {
if (pdf_enable_xfa) {
deps += [
":pdf_cfx_barcode_fuzzer",
- ":pdf_codec_bmp_fuzzer",
":pdf_codec_jpeg_fuzzer",
":pdf_css_fuzzer",
":pdf_fm2js_fuzzer",
":pdf_formcalc_fuzzer",
]
+ if (pdf_enable_xfa_bmp) {
+ deps += [ ":pdf_codec_bmp_fuzzer" ]
+ }
if (pdf_enable_xfa_gif) {
deps += [
":pdf_codec_gif_fuzzer",
@@ -85,11 +87,13 @@ if (pdf_enable_xfa) {
]
}
- pdfium_fuzzer("pdf_codec_bmp_fuzzer") {
- sources = [
- "pdf_codec_bmp_fuzzer.cc",
- "xfa_codec_fuzzer.h",
- ]
+ if (pdf_enable_xfa_bmp) {
+ pdfium_fuzzer("pdf_codec_bmp_fuzzer") {
+ sources = [
+ "pdf_codec_bmp_fuzzer.cc",
+ "xfa_codec_fuzzer.h",
+ ]
+ }
}
if (pdf_enable_xfa_gif) {
diff --git a/testing/libfuzzer/xfa_codec_fuzzer.h b/testing/libfuzzer/xfa_codec_fuzzer.h
index 483177e232..bcc3a5c7fe 100644
--- a/testing/libfuzzer/xfa_codec_fuzzer.h
+++ b/testing/libfuzzer/xfa_codec_fuzzer.h
@@ -7,13 +7,16 @@
#include <memory>
-#include "core/fxcodec/codec/ccodec_bmpmodule.h"
#include "core/fxcodec/codec/ccodec_progressivedecoder.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_BMP
+#include "core/fxcodec/codec/ccodec_bmpmodule.h"
+#endif // PDF_ENABLE_XFA_BMP
+
#ifdef PDF_ENABLE_XFA_GIF
#include "core/fxcodec/codec/ccodec_gifmodule.h"
#endif // PDF_ENABLE_XFA_GIF
@@ -34,7 +37,9 @@ class XFACodecFuzzer {
public:
static int Fuzz(const uint8_t* data, size_t size, FXCODEC_IMAGE_TYPE type) {
auto mgr = pdfium::MakeUnique<CCodec_ModuleMgr>();
+#ifdef PDF_ENABLE_XFA_BMP
mgr->SetBmpModule(pdfium::MakeUnique<CCodec_BmpModule>());
+#endif // PDF_ENABLE_XFA_BMP
#ifdef PDF_ENABLE_XFA_GIF
mgr->SetGifModule(pdfium::MakeUnique<CCodec_GifModule>());
#endif // PDF_ENABLE_XFA_GIF