summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc4
-rw-r--r--testing/libfuzzer/pdf_css_fuzzer.cc10
-rw-r--r--testing/libfuzzer/pdf_xml_fuzzer.cc6
3 files changed, 9 insertions, 11 deletions
diff --git a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
index 94decbfc2c..d99457d360 100644
--- a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
+++ b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
@@ -4,6 +4,7 @@
#include <memory>
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "xfa/fde/xml/cfx_saxreader.h"
#include "xfa/fgas/crt/fgas_stream.h"
#include "xfa/fxfa/parser/cxfa_widetextread.h"
@@ -11,8 +12,7 @@
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)));
- std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> stream(
- new CXFA_WideTextRead(input));
+ auto stream = pdfium::MakeRetain<CXFA_WideTextRead>(input);
if (!stream)
return 0;
diff --git a/testing/libfuzzer/pdf_css_fuzzer.cc b/testing/libfuzzer/pdf_css_fuzzer.cc
index 96877f40be..247c9b9245 100644
--- a/testing/libfuzzer/pdf_css_fuzzer.cc
+++ b/testing/libfuzzer/pdf_css_fuzzer.cc
@@ -4,6 +4,7 @@
#include <memory>
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/css/fde_css.h"
#include "xfa/fde/css/fde_csssyntax.h"
@@ -11,16 +12,15 @@
#include "xfa/fxfa/parser/cxfa_widetextread.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- CFDE_CSSSyntaxParser parser;
-
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
- std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> stream(
- new CXFA_WideTextRead(input));
+
+ auto stream = pdfium::MakeRetain<CXFA_WideTextRead>(input);
if (!stream)
return 0;
- parser.Init(stream.get(), 1024);
+ CFDE_CSSSyntaxParser parser;
+ parser.Init(stream, 1024);
FDE_CSSSYNTAXSTATUS status = parser.DoSyntaxParse();
while (status != FDE_CSSSYNTAXSTATUS_Error &&
diff --git a/testing/libfuzzer/pdf_xml_fuzzer.cc b/testing/libfuzzer/pdf_xml_fuzzer.cc
index d28522c2ea..4f000ab78e 100644
--- a/testing/libfuzzer/pdf_xml_fuzzer.cc
+++ b/testing/libfuzzer/pdf_xml_fuzzer.cc
@@ -52,15 +52,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input =
CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie()));
- std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> stream(
- new CXFA_WideTextRead(input));
+ auto stream = pdfium::MakeRetain<CXFA_WideTextRead>(input);
if (!stream)
return 0;
std::unique_ptr<CFDE_XMLDoc> doc = pdfium::MakeUnique<CFDE_XMLDoc>();
std::unique_ptr<CFDE_XMLParser, ReleaseDeleter<CFDE_XMLParser>> parser(
- new CXFA_XMLParser(doc->GetRoot(), stream.get()));
-
+ new CXFA_XMLParser(doc->GetRoot(), stream));
if (!doc->LoadXML(parser.release()))
return 0;