From a995d6fd9b862dbd37aebb9c323766bb5d11d389 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 12 Apr 2018 13:15:59 +0000 Subject: Allow retrieving the XML tree from the CFX_XMLDoc This CL allows the CXFA_SimpleParser to retrieve the XML tree from the CFX_XMLDoc. This way, we don't have to keep the doc around and can store the pointer to the tree in the CXFA_SimpleParser. Change-Id: I5b478acbe61e6f1ca5fa04d03133a2b327a0cb1c Reviewed-on: https://pdfium-review.googlesource.com/30210 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- testing/libfuzzer/pdf_xml_fuzzer.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'testing/libfuzzer') diff --git a/testing/libfuzzer/pdf_xml_fuzzer.cc b/testing/libfuzzer/pdf_xml_fuzzer.cc index 82627e1496..2ad57cf8bc 100644 --- a/testing/libfuzzer/pdf_xml_fuzzer.cc +++ b/testing/libfuzzer/pdf_xml_fuzzer.cc @@ -22,12 +22,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { RetainPtr stream = pdfium::MakeRetain(const_cast(data), size); - auto doc = pdfium::MakeUnique(stream); - if (doc->Load() < 100) + CFX_XMLDoc doc; + if (!doc.Load(stream)) return 0; - CFX_XMLNode* pXMLFakeRoot = doc->GetRoot(); - for (CFX_XMLNode* pXMLNode = pXMLFakeRoot->GetFirstChild(); pXMLNode; + auto root = doc.GetTree(); + for (CFX_XMLNode* pXMLNode = root->GetFirstChild(); pXMLNode; pXMLNode = pXMLNode->GetNextSibling()) { if (pXMLNode->GetType() == FX_XMLNODE_Element) break; -- cgit v1.2.3