diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-02-13 21:44:33 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-13 21:44:33 +0000 |
commit | fa3765cce4da4c3923e525f0462afd794360d221 (patch) | |
tree | 2a246bc47d7584edf5d8dd2c124f6c21c26cd5c8 /testing/libfuzzer/pdf_xml_fuzzer.cc | |
parent | 9c112f92d4c2046d5a4f8538f4d18b74a87649d4 (diff) | |
download | pdfium-fa3765cce4da4c3923e525f0462afd794360d221.tar.xz |
Cleanup CFX_XMLNode pointers
This CL cleans up hte CFX_XMLNode pointers. Each pointer has been
renamed to make the usage clearer, the NodeItems method has been removed
in favour of distinct accessors and the node pointers have been made
private.
Change-Id: I5459a77a0ae93b08741a0cd59266ef9c81ddad75
Reviewed-on: https://pdfium-review.googlesource.com/26550
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'testing/libfuzzer/pdf_xml_fuzzer.cc')
-rw-r--r-- | testing/libfuzzer/pdf_xml_fuzzer.cc | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/testing/libfuzzer/pdf_xml_fuzzer.cc b/testing/libfuzzer/pdf_xml_fuzzer.cc index d8010f90f8..3a2889421f 100644 --- a/testing/libfuzzer/pdf_xml_fuzzer.cc +++ b/testing/libfuzzer/pdf_xml_fuzzer.cc @@ -14,37 +14,6 @@ #include "core/fxcrt/xml/cfx_xmlparser.h" #include "third_party/base/ptr_util.h" -namespace { - -CFX_XMLNode* XFA_FDEExtension_GetDocumentNode( - CFX_XMLDoc* pXMLDoc, - bool bVerifyWellFormness = false) { - if (!pXMLDoc) { - return nullptr; - } - CFX_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot(); - for (CFX_XMLNode* pXMLNode = - pXMLFakeRoot->GetNodeItem(CFX_XMLNode::FirstChild); - pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) { - if (pXMLNode->GetType() == FX_XMLNODE_Element) { - if (bVerifyWellFormness) { - for (CFX_XMLNode* pNextNode = - pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling); - pNextNode; - pNextNode = pNextNode->GetNodeItem(CFX_XMLNode::NextSibling)) { - if (pNextNode->GetType() == FX_XMLNODE_Element) { - return nullptr; - } - } - } - return pXMLNode; - } - } - return nullptr; -} - -} // namespace - extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { FX_SAFE_SIZE_T safe_size = size; if (!safe_size.IsValid()) @@ -60,6 +29,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (doc->DoLoad() < 100) return 0; - (void)XFA_FDEExtension_GetDocumentNode(doc.get()); + CFX_XMLNode* pXMLFakeRoot = doc->GetRoot(); + for (CFX_XMLNode* pXMLNode = pXMLFakeRoot->GetFirstChild(); pXMLNode; + pXMLNode = pXMLNode->GetNextSibling()) { + if (pXMLNode->GetType() == FX_XMLNODE_Element) + break; + } return 0; } |