From 03f5bab415cda066855e2672154358056649c584 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 20 Apr 2017 10:47:41 -0700 Subject: Do not insert null node if ParseAsXDPPacket_Config fails Doing so trips an assert in the debug build but is harmless otherwise. This appears to be wrong since the beginning of time. Bug: 709793 Change-Id: I179f6944a3f7b2a89efa65a16078f6f58448ba4b Reviewed-on: https://pdfium-review.googlesource.com/4390 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- xfa/fxfa/parser/cxfa_simple_parser.cpp | 3 ++- xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index db15a80a44..4773fda22a 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -485,7 +485,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( pXMLConfigDOMRoot = pChildItem; pXFAConfigDOMRoot = ParseAsXDPPacket_Config(pXMLConfigDOMRoot, XFA_XDPPACKET_Config); - pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr); + if (pXFAConfigDOMRoot) + pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr); } CFX_XMLNode* pXMLDatasetsDOMRoot = nullptr; diff --git a/xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp b/xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp index a33169646d..174febf9ee 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser_embeddertest.cpp @@ -13,3 +13,10 @@ TEST_F(CXFASimpleParserEmbeddertest, Bug_216) { EXPECT_NE(nullptr, page); UnloadPage(page); } + +TEST_F(CXFASimpleParserEmbeddertest, Bug_709793) { + EXPECT_TRUE(OpenDocument("bug_709793.pdf")); + FPDF_PAGE page = LoadPage(0); + EXPECT_NE(nullptr, page); + UnloadPage(page); +} -- cgit v1.2.3