[poppler] poppler/PDFDoc.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Aug 27 13:17:02 PDT 2015


 poppler/PDFDoc.cc |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit d06c27584ecf4b7ff2fe492f0133722ac461dfd6
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Thu Aug 27 22:16:03 2015 +0200

    File Saving improvements
    
    Refinement of the /P annotation test
    
    Fixes file from comment #8 in bug #87637

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index da95ff0..e99af26 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -26,7 +26,7 @@
 // Copyright (C) 2010 Ilya Gorenbein <igorenbein at finjan.com>
 // Copyright (C) 2010 Srinivas Adicherla <srinivas.adicherla at geodesic.com>
 // Copyright (C) 2010 Philip Lorenz <lorenzph+freedesktop at gmail.com>
-// Copyright (C) 2011-2014 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2011-2015 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013, 2014 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Adam Reichold <adamreichold at myopera.com>
@@ -1612,10 +1612,27 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui
                 type.free();
                 continue;
               } else {
-                array->remove(i);
+                Object page;
+                getXRef()->fetch(obj2.getRef().num, obj2.getRef().gen, &page);
+                if (page.isDict()) {
+                  Object pagetype;
+                  Dict *dict = page.getDict();
+                  dict->lookup("Type", &pagetype);
+                  if (!pagetype.isName() || strcmp(pagetype.getName(), "Page") != 0) {
+                    obj1.free();
+                    obj2.free();
+                    type.free();
+                    page.free();
+                    pagetype.free();
+                    continue;
+                  }
+                  pagetype.free();
+                }
+                page.free();
                 obj1.free();
                 obj2.free();
                 type.free();
+                array->remove(i);
                 modified = gTrue;
                 continue;
               }


More information about the poppler mailing list