changeset 116:4169f6296ed7

Fixed RH691259: Midori sends a SIGSEGV with the IcedTea NP Plugin
author Deepak Bhole <dbhole@redhat.com>
date Mon, 18 Apr 2011 11:36:52 -0400
parents 218e20b249b8
children 2b7512af4dcc
files ChangeLog plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 07 18:06:40 2011 -0400
+++ b/ChangeLog	Mon Apr 18 11:36:52 2011 -0400
@@ -1,3 +1,10 @@
+2011-04-18  Deepak Bhole <dbhole@redhat.com>
+
+	RH691259: Midori sends a SIGSEGV with the IcedTea NP Plugin
+	* plugin/icedteanp/IcedTeaNPPlugin.cc (NP_Initialize): Rather than
+	returning immediately if already initialized, return after function tables
+	are reset.
+
 2011-04-07  Deepak Bhole <dbhole@redhat.com>
 
 	* plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Thu Apr 07 18:06:40 2011 -0400
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Mon Apr 18 11:36:52 2011 -0400
@@ -2005,14 +2005,12 @@
 {
   PLUGIN_DEBUG ("NP_Initialize\n");
 
-  if (initialized)
-    return NPERR_NO_ERROR;
-  else if ((browserTable == NULL) || (pluginTable == NULL))
-    {
-      PLUGIN_ERROR ("Browser or plugin function table is NULL.");
-
-      return NPERR_INVALID_FUNCTABLE_ERROR;
-    }
+  if ((browserTable == NULL) || (pluginTable == NULL))
+  {
+    PLUGIN_ERROR ("Browser or plugin function table is NULL.");
+
+    return NPERR_INVALID_FUNCTABLE_ERROR;
+  }
 
   // Ensure that the major version of the plugin API that the browser
   // expects is not more recent than the major version of the API that
@@ -2119,6 +2117,12 @@
   pluginTable->getvalue = NPP_GetValueProcPtr (ITNP_GetValue);
 #endif
 
+  // Re-setting the above tables multiple times is OK (as the 
+  // browser may change its function locations). However 
+  // anything beyond this point should only run once.
+  if (initialized)
+    return NPERR_NO_ERROR;
+
   // Make sure the plugin data directory exists, creating it if
   // necessary.
   data_directory = g_strconcat (P_tmpdir, NULL);