[poppler] 2 commits - glib/poppler-layer.cc poppler/PDFDoc.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Tue Aug 3 04:07:23 PDT 2010


 glib/poppler-layer.cc |    4 +++-
 poppler/PDFDoc.cc     |   27 +++++++++++++++------------
 2 files changed, 18 insertions(+), 13 deletions(-)

New commits:
commit bdd617f2177a7836f6b6686fde892664513a32a7
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Tue Aug 3 13:05:26 2010 +0200

    [glib] Fix a crash when a layer doesn't have a name
    
    Fixes bug #28842.

diff --git a/glib/poppler-layer.cc b/glib/poppler-layer.cc
index 12f06b7..8a481dd 100644
--- a/glib/poppler-layer.cc
+++ b/glib/poppler-layer.cc
@@ -75,6 +75,7 @@ _poppler_layer_new (PopplerDocument *document,
 		    GList           *rbgroup)
 {
   PopplerLayer *poppler_layer;
+  GooString    *layer_name;
 
   g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL);
   g_return_val_if_fail (layer != NULL, NULL);
@@ -84,7 +85,8 @@ _poppler_layer_new (PopplerDocument *document,
   poppler_layer->document = (PopplerDocument *)g_object_ref (document);
   poppler_layer->layer = layer;
   poppler_layer->rbgroup = rbgroup;
-  poppler_layer->title = _poppler_goo_string_to_utf8 (layer->oc->getName ());
+  layer_name = layer->oc->getName ();
+  poppler_layer->title = layer_name ? _poppler_goo_string_to_utf8 (layer_name) : NULL;
   
   return poppler_layer;
 }
commit e9f0646ca664cc27825f7e084f8419fe0de1fcfc
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Tue Aug 3 13:02:52 2010 +0200

    Catalog page array might contain NULL for some pages in invalid documents
    
    Fixes a crash reproducible with gtk-splash-test when opening document
    attached to bug #28842.

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index ade5fe4..33a2b4d 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -368,10 +368,11 @@ void PDFDoc::displayPage(OutputDev *out, int page,
   if (globalParams->getPrintCommands()) {
     printf("***** page %d *****\n", page);
   }
-  catalog->getPage(page)->display(out, hDPI, vDPI,
-				  rotate, useMediaBox, crop, printing, catalog,
-				  abortCheckCbk, abortCheckCbkData,
-				  annotDisplayDecideCbk, annotDisplayDecideCbkData);
+  if (catalog->getPage(page))
+    catalog->getPage(page)->display(out, hDPI, vDPI,
+				    rotate, useMediaBox, crop, printing, catalog,
+				    abortCheckCbk, abortCheckCbkData,
+				    annotDisplayDecideCbk, annotDisplayDecideCbkData);
 }
 
 void PDFDoc::displayPages(OutputDev *out, int firstPage, int lastPage,
@@ -398,20 +399,22 @@ void PDFDoc::displayPageSlice(OutputDev *out, int page,
 			      void *abortCheckCbkData,
                               GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data),
                               void *annotDisplayDecideCbkData) {
-  catalog->getPage(page)->displaySlice(out, hDPI, vDPI,
-				       rotate, useMediaBox, crop,
-				       sliceX, sliceY, sliceW, sliceH,
-				       printing, catalog,
-				       abortCheckCbk, abortCheckCbkData,
-				       annotDisplayDecideCbk, annotDisplayDecideCbkData);
+  if (catalog->getPage(page))
+    catalog->getPage(page)->displaySlice(out, hDPI, vDPI,
+					 rotate, useMediaBox, crop,
+					 sliceX, sliceY, sliceW, sliceH,
+					 printing, catalog,
+					 abortCheckCbk, abortCheckCbkData,
+					 annotDisplayDecideCbk, annotDisplayDecideCbkData);
 }
 
 Links *PDFDoc::getLinks(int page) {
-  return catalog->getPage(page)->getLinks(catalog);
+  return catalog->getPage(page) ? catalog->getPage(page)->getLinks(catalog) : NULL;
 }
   
 void PDFDoc::processLinks(OutputDev *out, int page) {
-  catalog->getPage(page)->processLinks(out, catalog);
+  if (catalog->getPage(page))
+    catalog->getPage(page)->processLinks(out, catalog);
 }
 
 GBool PDFDoc::isLinearized() {


More information about the poppler mailing list