From 3112e1aed533fe7ee58dd8cba2e4cd768372dfd6 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Mon, 25 Feb 2019 03:01:12 +0000 Subject: xpdf-4.01 git-svn-id: svn://tug.org/texlive/trunk@50122 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc') diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc index e1b8be98936..470807314a6 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc @@ -453,8 +453,13 @@ GBool Catalog::readPageTree(Object *catDict) { } if (topPagesObj.dictLookup("Count", &countObj)->isInt()) { numPages = countObj.getInt(); - if (numPages == 0) { - // Acrobat apparently scans the page tree if it sees a zero count + if (numPages == 0 || numPages > 50000) { + // 1. Acrobat apparently scans the page tree if it sees a zero + // count. + // 2. Absurdly large page counts result in very slow loading, + // because other code tries to fetch pages 1 through n. + // In both cases: ignore the given page count and scan the tree + // instead. numPages = countPageTree(&topPagesObj); } } else { -- cgit v1.2.3