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

Unified Diff: testing/libfuzzer/pdf_streamparser_fuzzer.cc

Issue 2262703003: Add fuzzer for CPDF_StreamParser (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 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 | « testing/libfuzzer/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/pdf_streamparser_fuzzer.cc
diff --git a/testing/libfuzzer/pdf_psengine_fuzzer.cc b/testing/libfuzzer/pdf_streamparser_fuzzer.cc
similarity index 54%
copy from testing/libfuzzer/pdf_psengine_fuzzer.cc
copy to testing/libfuzzer/pdf_streamparser_fuzzer.cc
index 89f582ec64ffa2cb0165c4097715fb8f1b435af3..607c44b0440c3b86c8af649d427ff4b98e3f8883 100644
--- a/testing/libfuzzer/pdf_psengine_fuzzer.cc
+++ b/testing/libfuzzer/pdf_streamparser_fuzzer.cc
@@ -2,13 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fpdfapi/fpdf_page/cpdf_psengine.h"
+#include "core/fpdfapi/fpdf_page/pageint.h"
#include <cstdint>
+#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- CPDF_PSEngine engine;
- if (engine.Parse(reinterpret_cast<const char*>(data), size))
- engine.Execute();
+ CPDF_StreamParser parser(data, size);
+ while (CPDF_Object* pObj = parser.ReadNextObject(true, 0))
+ pObj->Release();
+
return 0;
}
« no previous file with comments | « testing/libfuzzer/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698