summaryrefslogtreecommitdiff
path: root/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-12 11:32:32 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-12 17:23:27 +0000
commit9d6a2089c93c94461289b21a29771039eace95e7 (patch)
tree5b747786fe129b20aaf2ba3271e7b99051f5ae99 /testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
parentb333c9ec415c132451f4a10487b84f91124d08e8 (diff)
downloadpdfium-9d6a2089c93c94461289b21a29771039eace95e7.tar.xz
Remove MakeSeekableReadStream
This Cl removes the MakeSeekableReadStream call and, at the one place it's used, creates an IFX_MemoryStream which is a seekable read stream. Change-Id: I6b0b23636eff47f8caca5432313ba99703e21e4d Reviewed-on: https://pdfium-review.googlesource.com/4037 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc')
-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);