summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/libfuzzer/xfa_codec_fuzzer.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/testing/libfuzzer/xfa_codec_fuzzer.h b/testing/libfuzzer/xfa_codec_fuzzer.h
index 8608993396..9a8b23e368 100644
--- a/testing/libfuzzer/xfa_codec_fuzzer.h
+++ b/testing/libfuzzer/xfa_codec_fuzzer.h
@@ -7,16 +7,26 @@
#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/fxcrt/fx_stream.h"
+#include "third_party/base/ptr_util.h"
class XFACodecFuzzer {
public:
static int Fuzz(const uint8_t* data, size_t size, FXCODEC_IMAGE_TYPE type) {
- std::unique_ptr<CCodec_ModuleMgr> mgr(new CCodec_ModuleMgr());
- std::unique_ptr<CCodec_ProgressiveDecoder> decoder(
- mgr->CreateProgressiveDecoder());
+ auto mgr = pdfium::MakeUnique<CCodec_ModuleMgr>();
+ mgr->SetBmpModule(pdfium::MakeUnique<CCodec_BmpModule>());
+ mgr->SetGifModule(pdfium::MakeUnique<CCodec_GifModule>());
+ mgr->SetPngModule(pdfium::MakeUnique<CCodec_PngModule>());
+ mgr->SetTiffModule(pdfium::MakeUnique<CCodec_TiffModule>());
+
+ std::unique_ptr<CCodec_ProgressiveDecoder> decoder =
+ mgr->CreateProgressiveDecoder();
CFX_RetainPtr<Reader> source(new Reader(data, size));
FXCODEC_STATUS status = decoder->LoadImageInfo(source, type, nullptr, true);
if (status != FXCODEC_STATUS_FRAME_READY)