poppler/Annot.cc |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 58a3b83a8fbd8b13eb98c4f677f4ed19b6ae44cd
Author: Pino Toscano <[email protected]>
Date:   Tue Mar 1 15:35:45 2011 +0100

    fix appendAnnot() invocation on annotations reading
    
    1) check that the annot is actually a non-NULL pointer (otherwise doing 
anything else is pointless)
    2) call appendAnnot() only if the annotation isOk() (that will increase the 
annot refcount), but always decrement the refcount (so valid annotation will 
have it at 1, while invalid will be deleted)

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 5a5ba2e..d55d665 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -5274,8 +5274,12 @@ Annots::Annots(XRef *xref, Catalog *catalog, Object 
*annotsObj) {
       if (annotsObj->arrayGet(i, &obj1)->isDict()) {
         annotsObj->arrayGetNF(i, &obj2);
         annot = createAnnot (xref, obj1.getDict(), catalog, &obj2);
-        appendAnnot(annot);
-        annot->decRefCnt();
+        if (annot) {
+          if (annot->isOk()) {
+            appendAnnot(annot);
+          }
+          annot->decRefCnt();
+        }
       }
       obj2.free();
       obj1.free();
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to