OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "pdf/pdfium/fuzzers/pdfium_fuzzer_helper.h" |
| 6 |
| 7 class PDFiumXFAFuzzer : public PDFiumFuzzerHelper { |
| 8 public: |
| 9 PDFiumXFAFuzzer() : PDFiumFuzzerHelper() {} |
| 10 ~PDFiumXFAFuzzer() override {} |
| 11 |
| 12 int GetFormCallbackVersion() const override { return 2; } |
| 13 |
| 14 // Return false if XFA doesn't load as otherwise we're duplicating the work |
| 15 // done by the non-xfa fuzzer. |
| 16 bool OnFormFillEnvLoaded(FPDF_DOCUMENT doc) override { |
| 17 int doc_type = DOCTYPE_PDF; |
| 18 if (!FPDF_HasXFAField(doc, &doc_type) || doc_type == DOCTYPE_PDF) |
| 19 return false; |
| 20 return FPDF_LoadXFA(doc); |
| 21 } |
| 22 }; |
| 23 |
| 24 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 25 PDFiumXFAFuzzer fuzzer; |
| 26 fuzzer.RenderPdf(reinterpret_cast<const char*>(data), size); |
| 27 return 0; |
| 28 } |
OLD | NEW |