Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Unified Diff: pdf/pdfium/fuzzers/pdfium_xfa_fuzzer.cc

Issue 2754103002: Add XFA pdfium fuzzer (Closed)
Patch Set: seed corpus Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pdf/pdfium/fuzzers/pdfium_fuzzer_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/fuzzers/pdfium_xfa_fuzzer.cc
diff --git a/pdf/pdfium/fuzzers/pdfium_xfa_fuzzer.cc b/pdf/pdfium/fuzzers/pdfium_xfa_fuzzer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..379a95b3c4ba00a0920b77a4f3b4578bea47a283
--- /dev/null
+++ b/pdf/pdfium/fuzzers/pdfium_xfa_fuzzer.cc
@@ -0,0 +1,28 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "pdf/pdfium/fuzzers/pdfium_fuzzer_helper.h"
+
+class PDFiumXFAFuzzer : public PDFiumFuzzerHelper {
+ public:
+ PDFiumXFAFuzzer() : PDFiumFuzzerHelper() {}
+ ~PDFiumXFAFuzzer() override {}
+
+ int GetFormCallbackVersion() const override { return 2; }
+
+ // Return false if XFA doesn't load as otherwise we're duplicating the work
+ // done by the non-xfa fuzzer.
+ bool OnFormFillEnvLoaded(FPDF_DOCUMENT doc) override {
+ int doc_type = DOCTYPE_PDF;
+ if (!FPDF_HasXFAField(doc, &doc_type) || doc_type == DOCTYPE_PDF)
+ return false;
+ return FPDF_LoadXFA(doc);
+ }
+};
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ PDFiumXFAFuzzer fuzzer;
+ fuzzer.RenderPdf(reinterpret_cast<const char*>(data), size);
+ return 0;
+}
« no previous file with comments | « pdf/pdfium/fuzzers/pdfium_fuzzer_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698