summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-03-15 16:21:02 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-15 21:35:55 +0000
commitc467d4619ebe0bae9a87b667ca9a06f576138f68 (patch)
treeb5512ee33f689818458e6ab8f4376019b8a0811c /core/fpdfapi/parser/cpdf_document.cpp
parentc8493852c7a07241c18e14cb0a8d6292b1314726 (diff)
downloadpdfium-c467d4619ebe0bae9a87b667ca9a06f576138f68.tar.xz
Reset tree traversal when we think we're at the startchromium/3043
If the PDF declares it has a gazillion pages when it does not, we just start traversing again from the start. This CL fixes that. BUG=chromium:680222 Change-Id: Ie9b55abc0aaa372429b3d995a7e1e7ab58fb7965 Reviewed-on: https://pdfium-review.googlesource.com/3060 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 8ff9e66506..c047085cf3 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -503,9 +503,11 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
// TODO(art-snake): optimize this.
ResetTraversal();
}
- int nPagesToGo = iPage - m_iNextPageToTraverse + 1;
- if (m_pTreeTraversal.empty())
+ if (m_pTreeTraversal.empty()) {
+ ResetTraversal();
m_pTreeTraversal.push_back(std::make_pair(pPages, 0));
+ }
+ int nPagesToGo = iPage - m_iNextPageToTraverse + 1;
CPDF_Dictionary* pPage = TraversePDFPages(iPage, &nPagesToGo, 0);
m_iNextPageToTraverse = iPage + 1;
return pPage;