From 478c226d70fa560d558d459234e684c47d0d3fe5 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Tue, 21 Mar 2017 14:06:04 -0400 Subject: Pop when Pages is malformed and has no kids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the Kids array for the Pages dictionary does not exist, just treat this dictionary as the unique page in the document. BUG=chromium:702883 Change-Id: I9cb9645a53d60306ffe563f9b27cbbd37442f4ec Reviewed-on: https://pdfium-review.googlesource.com/3135 Commit-Queue: Nicolás Peña Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fpdfapi/parser/cpdf_document.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'core/fpdfapi/parser/cpdf_document.cpp') diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index c047085cf3..dec0f5097e 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -406,6 +406,7 @@ CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, CPDF_Dictionary* pPages = m_pTreeTraversal[level].first; CPDF_Array* pKidList = pPages->GetArrayFor("Kids"); if (!pKidList) { + m_pTreeTraversal.pop_back(); if (*nPagesToGo != 1) return nullptr; m_PageList[iPage] = pPages->GetObjNum(); -- cgit v1.2.3