summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc16
1 files changed, 4 insertions, 12 deletions
diff --git a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
index 00b55cdbd4..0dfbbdf639 100644
--- a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
+++ b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
@@ -10,20 +10,12 @@
#include "xfa/fxfa/parser/cxfa_widetextread.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- CFX_WideString input = CFX_WideString::FromUTF8(
- CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
- auto stream = pdfium::MakeRetain<CXFA_WideTextRead>(input);
- if (!stream)
- return 0;
-
- CFX_RetainPtr<IFX_SeekableReadStream> fileRead =
- stream->MakeSeekableReadStream();
- if (!fileRead)
- return 0;
-
CFX_SAXReader reader;
- if (reader.StartParse(fileRead, 0, -1, CFX_SaxParseMode_NotSkipSpace) < 0)
+ if (reader.StartParse(
+ IFX_MemoryStream::Create(const_cast<uint8_t*>(data), size), 0, -1,
+ CFX_SaxParseMode_NotSkipSpace) < 0) {
return 0;
+ }
while (1) {
int32_t ret = reader.ContinueParse(nullptr);