head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.28 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.26 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.24 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.22 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.20 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.18 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.16 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.14 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.12 pkgsrc-2008Q2-base:1.2 pkgsrc-2008Q1:1.2.0.10 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.8 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.6 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.4 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.2 pkgsrc-2007Q1-base:1.2; locks; strict; comment @# @; 1.2 date 2007.03.13.11.07.23; author drochner; state dead; branches; next 1.1; 1.1 date 2007.01.17.17.38.05; author drochner; state Exp; branches; next ; desc @@ 1.2 log @oops - remove obsolete patches @ text @$NetBSD: patch-av,v 1.1 2007/01/17 17:38:05 drochner Exp $ --- xpdf/Catalog.cc.orig 2005-08-17 07:34:31.000000000 +0200 +++ xpdf/Catalog.cc @@@@ -23,6 +23,12 @@@@ #include "Link.h" #include "Catalog.h" +// This define is used to limit the depth of recursive readPageTree calls +// This is needed because the page tree nodes can reference their parents +// leaving us in an infinite loop +// Most sane pdf documents don't have a call depth higher than 10 +#define MAX_CALL_DEPTH 1000 + //------------------------------------------------------------------------ // Catalog //------------------------------------------------------------------------ @@@@ -71,7 +77,7 @@@@ Catalog::Catalog(XRef *xrefA) { pageRefs[i].num = -1; pageRefs[i].gen = -1; } - numPages = readPageTree(pagesDict.getDict(), NULL, 0); + numPages = readPageTree(pagesDict.getDict(), NULL, 0, 0); if (numPages != numPages0) { error(-1, "Page count in top-level pages object is incorrect"); } @@@@ -169,7 +175,7 @@@@ GString *Catalog::readMetadata() { return s; } -int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start) { +int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start, int callDepth) { Object kids; Object kid; Object kidRef; @@@@ -214,9 +220,13 @@@@ int Catalog::readPageTree(Dict *pagesDic // This should really be isDict("Pages"), but I've seen at least one // PDF file where the /Type entry is missing. } else if (kid.isDict()) { - if ((start = readPageTree(kid.getDict(), attrs1, start)) - < 0) - goto err2; + if (callDepth > MAX_CALL_DEPTH) { + error(-1, "Limit of %d recursive calls reached while reading the page tree. If your document is correct and not a test to try to force a crash, please report a bug.", MAX_CALL_DEPTH); + } else { + if ((start = readPageTree(kid.getDict(), attrs1, start, callDepth + 1)) + < 0) + goto err2; + } } else { error(-1, "Kid object (page %d) is wrong type (%s)", start+1, kid.getTypeName()); @ 1.1 log @apply the patch from poppler to fix MOAB-06-01-2007 (DOS) bump PKGREVISION @ text @d1 1 a1 1 $NetBSD$ @