From 25de92431b602ba2b5f67f83ff3dba032cae99bb Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Tue, 21 Aug 2012 14:38:51 -0400 Subject: [PATCH] Bug 700583 - Null-check our way out of crashes on both mobile and desktop in pr_FindSymbolInLib caused by plugin code where the plugin fails to load correctly, r=josh --- dom/plugins/base/nsPluginsDirUnix.cpp | 4 ++++ dom/plugins/ipc/PluginModuleChild.cpp | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index 698f5d22ce0..3e242f2e541 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -307,6 +307,10 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary) printf("LoadPlugin() %s returned %lx\n", libSpec.value.pathname, (unsigned long)pLibrary); #endif + + if (!pLibrary) { + return NS_ERROR_FAILURE; + } return NS_OK; } diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 52b027a77ce..029b81551c3 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -182,8 +182,9 @@ PluginModuleChild::Init(const std::string& aPluginFilename, if (!mLibrary) #endif { - DebugOnly rv = pluginFile.LoadPlugin(&mLibrary); - NS_ASSERTION(NS_OK == rv, "trouble with mPluginFile"); + nsresult rv = pluginFile.LoadPlugin(&mLibrary); + if (NS_FAILED(rv)) + return false; } NS_ASSERTION(mLibrary, "couldn't open shared object");