75a61b
From 1e6541a3a443db7afd3046483c0fd994b31d128c Mon Sep 17 00:00:00 2001
75a61b
From: Jason Crain <jason@aquaticape.us>
75a61b
Date: Sat, 18 Apr 2015 12:44:47 -0500
75a61b
Subject: [PATCH] glib: Fix segfault when creating PopplerAction
75a61b
75a61b
Screen annotations and form fields currently pass a NULL pointer to
75a61b
_poppler_action_new.  Pass the PopplerDocument instead.
75a61b
75a61b
Bug #90093
75a61b
---
75a61b
 glib/poppler-annot.cc      | 4 ++--
75a61b
 glib/poppler-form-field.cc | 2 +-
75a61b
 glib/poppler-page.cc       | 2 +-
75a61b
 glib/poppler-private.h     | 2 +-
75a61b
 4 files changed, 5 insertions(+), 5 deletions(-)
75a61b
75a61b
diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
75a61b
index 15d48c5..312aa31 100644
75a61b
--- a/glib/poppler-annot.cc
75a61b
+++ b/glib/poppler-annot.cc
75a61b
@@ -559,7 +559,7 @@ poppler_annot_screen_class_init (PopplerAnnotScreenClass *klass)
75a61b
 }
75a61b
 
75a61b
 PopplerAnnot *
75a61b
-_poppler_annot_screen_new (Annot *annot)
75a61b
+_poppler_annot_screen_new (PopplerDocument *doc, Annot *annot)
75a61b
 {
75a61b
   PopplerAnnot *poppler_annot;
75a61b
   AnnotScreen  *annot_screen;
75a61b
@@ -569,7 +569,7 @@ _poppler_annot_screen_new (Annot *annot)
75a61b
   annot_screen = static_cast<AnnotScreen *>(poppler_annot->annot);
75a61b
   action = annot_screen->getAction();
75a61b
   if (action)
75a61b
-    POPPLER_ANNOT_SCREEN (poppler_annot)->action = _poppler_action_new (NULL, action, NULL);
75a61b
+    POPPLER_ANNOT_SCREEN (poppler_annot)->action = _poppler_action_new (doc, action, NULL);
75a61b
 
75a61b
   return poppler_annot;
75a61b
 }
75a61b
diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc
75a61b
index 5687799..df184dd 100644
75a61b
--- a/glib/poppler-form-field.cc
75a61b
+++ b/glib/poppler-form-field.cc
75a61b
@@ -188,7 +188,7 @@ poppler_form_field_get_action (PopplerFormField *field)
75a61b
   if (!action)
75a61b
     return NULL;
75a61b
 
75a61b
-  field->action = _poppler_action_new (NULL, action, NULL);
75a61b
+  field->action = _poppler_action_new (field->document, action, NULL);
75a61b
 
75a61b
   return field->action;
75a61b
 }
75a61b
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
75a61b
index db2387a..1025393 100644
75a61b
--- a/glib/poppler-page.cc
75a61b
+++ b/glib/poppler-page.cc
75a61b
@@ -1399,7 +1399,7 @@ poppler_page_get_annot_mapping (PopplerPage *page)
75a61b
         mapping->annot = _poppler_annot_movie_new (annot);
75a61b
 	break;
75a61b
       case Annot::typeScreen:
75a61b
-        mapping->annot = _poppler_annot_screen_new (annot);
75a61b
+        mapping->annot = _poppler_annot_screen_new (page->document, annot);
75a61b
 	break;
75a61b
       case Annot::typeLine:
75a61b
         mapping->annot = _poppler_annot_line_new (annot);
75a61b
diff --git a/glib/poppler-private.h b/glib/poppler-private.h
75a61b
index 874cfdb..9abdd7c 100644
75a61b
--- a/glib/poppler-private.h
75a61b
+++ b/glib/poppler-private.h
75a61b
@@ -130,7 +130,7 @@ PopplerAnnot      *_poppler_annot_free_text_new (Annot *annot);
75a61b
 PopplerAnnot      *_poppler_annot_text_markup_new     (Annot *annot);
75a61b
 PopplerAnnot      *_poppler_annot_file_attachment_new (Annot *annot);
75a61b
 PopplerAnnot      *_poppler_annot_movie_new (Annot *annot);
75a61b
-PopplerAnnot      *_poppler_annot_screen_new (Annot *annot);
75a61b
+PopplerAnnot      *_poppler_annot_screen_new (PopplerDocument *doc, Annot *annot);
75a61b
 PopplerAnnot      *_poppler_annot_line_new (Annot *annot);
75a61b
 PopplerAnnot      *_poppler_annot_circle_new (Annot *annot);
75a61b
 PopplerAnnot      *_poppler_annot_square_new (Annot *annot);
75a61b
-- 
75a61b
2.1.4
75a61b