Blob Blame Raw
From 1e6541a3a443db7afd3046483c0fd994b31d128c Mon Sep 17 00:00:00 2001
From: Jason Crain <jason@aquaticape.us>
Date: Sat, 18 Apr 2015 12:44:47 -0500
Subject: [PATCH] glib: Fix segfault when creating PopplerAction

Screen annotations and form fields currently pass a NULL pointer to
_poppler_action_new.  Pass the PopplerDocument instead.

Bug #90093
---
 glib/poppler-annot.cc      | 4 ++--
 glib/poppler-form-field.cc | 2 +-
 glib/poppler-page.cc       | 2 +-
 glib/poppler-private.h     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index 15d48c5..312aa31 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -559,7 +559,7 @@ poppler_annot_screen_class_init (PopplerAnnotScreenClass *klass)
 }
 
 PopplerAnnot *
-_poppler_annot_screen_new (Annot *annot)
+_poppler_annot_screen_new (PopplerDocument *doc, Annot *annot)
 {
   PopplerAnnot *poppler_annot;
   AnnotScreen  *annot_screen;
@@ -569,7 +569,7 @@ _poppler_annot_screen_new (Annot *annot)
   annot_screen = static_cast<AnnotScreen *>(poppler_annot->annot);
   action = annot_screen->getAction();
   if (action)
-    POPPLER_ANNOT_SCREEN (poppler_annot)->action = _poppler_action_new (NULL, action, NULL);
+    POPPLER_ANNOT_SCREEN (poppler_annot)->action = _poppler_action_new (doc, action, NULL);
 
   return poppler_annot;
 }
diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc
index 5687799..df184dd 100644
--- a/glib/poppler-form-field.cc
+++ b/glib/poppler-form-field.cc
@@ -188,7 +188,7 @@ poppler_form_field_get_action (PopplerFormField *field)
   if (!action)
     return NULL;
 
-  field->action = _poppler_action_new (NULL, action, NULL);
+  field->action = _poppler_action_new (field->document, action, NULL);
 
   return field->action;
 }
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index db2387a..1025393 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1399,7 +1399,7 @@ poppler_page_get_annot_mapping (PopplerPage *page)
         mapping->annot = _poppler_annot_movie_new (annot);
 	break;
       case Annot::typeScreen:
-        mapping->annot = _poppler_annot_screen_new (annot);
+        mapping->annot = _poppler_annot_screen_new (page->document, annot);
 	break;
       case Annot::typeLine:
         mapping->annot = _poppler_annot_line_new (annot);
diff --git a/glib/poppler-private.h b/glib/poppler-private.h
index 874cfdb..9abdd7c 100644
--- a/glib/poppler-private.h
+++ b/glib/poppler-private.h
@@ -130,7 +130,7 @@ PopplerAnnot      *_poppler_annot_free_text_new (Annot *annot);
 PopplerAnnot      *_poppler_annot_text_markup_new     (Annot *annot);
 PopplerAnnot      *_poppler_annot_file_attachment_new (Annot *annot);
 PopplerAnnot      *_poppler_annot_movie_new (Annot *annot);
-PopplerAnnot      *_poppler_annot_screen_new (Annot *annot);
+PopplerAnnot      *_poppler_annot_screen_new (PopplerDocument *doc, Annot *annot);
 PopplerAnnot      *_poppler_annot_line_new (Annot *annot);
 PopplerAnnot      *_poppler_annot_circle_new (Annot *annot);
 PopplerAnnot      *_poppler_annot_square_new (Annot *annot);
-- 
2.1.4