[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdegraphics/kpdf
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2005-04-27 8:19:37
Message-ID: 20050427081937.99382630 () office ! kde ! org
[Download RAW message or body]

CVS commit by aacid: 

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


  M +1 -0      core/document.cpp   1.42
  M +9 -2      xpdf/xpdf/Catalog.cc   1.3


--- kdegraphics/kpdf/core/document.cpp  #1.41:1.42
@@ -899,4 +899,5 @@ void KPDFDocument::processLink( const KP
             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

--- kdegraphics/kpdf/xpdf/xpdf/Catalog.cc  #1.2:1.3
@@ -400,11 +400,18 @@ GBool NameTree::lookup(GString *name, Ob
   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();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic