Don't crash on malformed documents that have links to unexistant places, for example in smli_tr-2005-143.pdf link [3] from page 4 does not point anywhere (Acrobat Reader confirms it)

BUGS: 104626

svn path=/trunk/kdegraphics/kpdf/; revision=408111
remotes/origin/kpdf-kde4
Albert Astals Cid 21 years ago
parent 1452bec703
commit 1e1eeb8e65
  1. 1
      core/document.cpp
  2. 11
      xpdf/xpdf/Catalog.cc

@ -898,6 +898,7 @@ void KPDFDocument::processLink( const KPDFLink * link )
case KPDFLink::Goto: {
const KPDFLinkGoto * go = static_cast< const KPDFLinkGoto * >( link );
d->nextDocumentViewport = go->destViewport();
if (d->nextDocumentViewport.pageNumber == -1) return;
// Explanation of why d->nextDocumentViewport is needed
// all openRelativeFile does is launch a signal telling we

@ -399,13 +399,20 @@ GBool NameTree::lookup(GString *name, Object *obj)
{
Entry *entry;
entry = *(Entry **) bsearch(name, entries,
Entry **e = (Entry **) bsearch(name, entries,
length, sizeof(Entry *), Entry::cmp);
if (e) entry = *e;
else
{
error(-1, "failed to look up %s\n", name->getCString());
obj->initNull();
return gFalse;
}
if (entry != NULL) {
entry->value.fetch(xref, obj);
return gTrue;
} else {
printf("failed to look up %s\n", name->getCString());
error(-1, "failed to look up %s\n", name->getCString());
obj->initNull();

Loading…
Cancel
Save