[poppler] Branch 'poppler-0.26' - 2 commits - glib/poppler-annot.cc poppler/Annot.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Fri Jul 25 02:29:35 PDT 2014


 glib/poppler-annot.cc |    2 +-
 poppler/Annot.cc      |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit a1ecff0f0ab81fe76f63244250d96e7ef275f402
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Jul 25 11:25:42 2014 +0200

    glib: Return NULL in poppler_annot_get_contents also for empty strings

diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index 13bc768..e87bce3 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -799,7 +799,7 @@ poppler_annot_get_contents (PopplerAnnot *poppler_annot)
 
   contents = poppler_annot->annot->getContents ();
 
-  return contents ? _poppler_goo_string_to_utf8 (contents) : NULL;
+  return contents && contents->getLength() > 0 ? _poppler_goo_string_to_utf8 (contents) : NULL;
 }
 
 /**
commit ab1113d10ef712c7c44cd4b4bb6bc79f9ca3702c
Author: Anuj Khare <khareanuj18 at gmail.com>
Date:   Thu Jul 24 19:47:22 2014 +0200

    annots: Fix a crash when adding annot without contents
    
    Having no content in an annotation results in a crash when generating
    its appearance, since the contents pointer is dereferenced.
    For consistency, the same has been done in Annot::initialize.

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index fa29739..a559836 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1265,7 +1265,7 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) {
   if (dict->lookup("Contents", &obj1)->isString()) {
     contents = obj1.getString()->copy();
   } else {
-    contents = NULL;
+    contents = new GooString();
   }
   obj1.free();
 
@@ -1641,9 +1641,7 @@ Annot::~Annot() {
   annotObj.free();
   
   delete rect;
-  
-  if (contents)
-    delete contents;
+  delete contents;
 
   if (name)
     delete name;
@@ -3015,6 +3013,8 @@ void AnnotFreeText::generateFreeTextAppearance()
     fontsize = 10;
   if (fontcolor == NULL)
     fontcolor = new AnnotColor(0, 0, 0); // Black
+  if (!contents)
+    contents = new GooString ();
 
   // Draw box
   GBool doFill = (color && color->getSpace() != AnnotColor::colorTransparent);


More information about the poppler mailing list