Commit a8a7ebd3 authored by alp@webkit.org's avatar alp@webkit.org

2008-11-06 Alp Toker <alp@nuanti.com>

        Reviewed by Cameron Zwarich.

        https://bugs.webkit.org/show_bug.cgi?id=22067
        [GTK] Sun Java plugin segfaults at PluginPackage::createPackage()

        null-check symbols loaded from plugin modules, initialize the function
        table (like Win already does) and update it with the latest
        additions. Adjust whitespace for easy diff'ing with the Win port code
        from which it was forked.

        This fixes crashes with libnspr4.so and any other plugins that don't
        provide the symbols we expect.

        * plugins/gtk/PluginPackageGtk.cpp:
        (WebCore::PluginPackage::fetchInfo):
        (WebCore::PluginPackage::load):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bdf1178c
2008-11-06 Alp Toker <alp@nuanti.com>
Reviewed by Cameron Zwarich.
https://bugs.webkit.org/show_bug.cgi?id=22067
[GTK] Sun Java plugin segfaults at PluginPackage::createPackage()
null-check symbols loaded from plugin modules, initialize the function
table (like Win already does) and update it with the latest
additions. Adjust whitespace for easy diff'ing with the Win port code
from which it was forked.
This fixes crashes with libnspr4.so and any other plugins that don't
provide the symbols we expect.
* plugins/gtk/PluginPackageGtk.cpp:
(WebCore::PluginPackage::fetchInfo):
(WebCore::PluginPackage::load):
2008-11-06 Kristian Amlie <kristian.amlie@nokia.com>
Reviewed by Simon Hausmann.
......@@ -86,12 +86,15 @@ bool PluginPackage::fetchInfo()
if (!load())
return false;
NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription;
NPP_GetValueProcPtr NPP_GetValue;
NP_GetMIMEDescriptionFuncPtr NP_GetMIMEDescription = 0;
NPP_GetValueProcPtr NPP_GetValue = 0;
g_module_symbol(m_module, "NP_GetMIMEDescription", (void**)&NP_GetMIMEDescription);
g_module_symbol(m_module, "NP_GetValue", (void**)&NPP_GetValue);
if (!NP_GetMIMEDescription || !NPP_GetValue)
return false;
char* buffer = 0;
NPError err = NPP_GetValue(0, NPPVpluginNameString, &buffer);
if (err == NPERR_NO_ERROR)
......@@ -152,7 +155,9 @@ bool PluginPackage::load()
m_isLoaded = true;
NP_InitializeFuncPtr NP_Initialize;
NP_InitializeFuncPtr NP_Initialize = 0;
m_NPP_Shutdown = 0;
NPError npErr;
g_module_symbol(m_module, "NP_Initialize", (void**)&NP_Initialize);
......@@ -164,8 +169,10 @@ bool PluginPackage::load()
memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs));
m_pluginFuncs.size = sizeof(m_pluginFuncs);
memset(&m_browserFuncs, 0, sizeof(m_browserFuncs));
m_browserFuncs.size = sizeof (m_browserFuncs);
m_browserFuncs.version = NP_VERSION_MINOR;
m_browserFuncs.geturl = NPN_GetURL;
m_browserFuncs.posturl = NPN_PostURL;
m_browserFuncs.requestread = NPN_RequestRead;
......@@ -189,6 +196,7 @@ bool PluginPackage::load()
m_browserFuncs.getJavaPeer = NPN_GetJavaPeer;
m_browserFuncs.pushpopupsenabledstate = NPN_PushPopupsEnabledState;
m_browserFuncs.poppopupsenabledstate = NPN_PopPopupsEnabledState;
m_browserFuncs.pluginthreadasynccall = NPN_PluginThreadAsyncCall;
m_browserFuncs.releasevariantvalue = _NPN_ReleaseVariantValue;
m_browserFuncs.getstringidentifier = _NPN_GetStringIdentifier;
......@@ -196,6 +204,7 @@ bool PluginPackage::load()
m_browserFuncs.getintidentifier = _NPN_GetIntIdentifier;
m_browserFuncs.identifierisstring = _NPN_IdentifierIsString;
m_browserFuncs.utf8fromidentifier = _NPN_UTF8FromIdentifier;
m_browserFuncs.intfromidentifier = _NPN_IntFromIdentifier;
m_browserFuncs.createobject = _NPN_CreateObject;
m_browserFuncs.retainobject = _NPN_RetainObject;
m_browserFuncs.releaseobject = _NPN_ReleaseObject;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment