Bug 1170676 - Fix null dereference in PluginModuleParent::StreamCast. r=jimm, a=lizzard
authorAaron Klotz <aklotz@mozilla.com>
Wed, 10 Jun 2015 11:08:46 -0600
changeset 275033 68a514413550f7decc4c7a61c2dc1485d4620357
parent 275032 ca0716b04edceaf358a6f1ed33cd85bb5a7ec16b
child 275034 4f1be725fa332e0a073c3886a2beef5dbb9480a2
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, lizzard
bugs1170676
milestone40.0a2
Bug 1170676 - Fix null dereference in PluginModuleParent::StreamCast. r=jimm, a=lizzard
dom/plugins/ipc/PluginModuleParent.cpp
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -1811,17 +1811,17 @@ PluginModuleParent::StreamCast(NPP insta
 {
     PluginInstanceParent* ip = PluginInstanceParent::Cast(instance, aSurrogate);
     if (!ip || (aSurrogate && *aSurrogate && ip->UseSurrogate())) {
         return nullptr;
     }
 
     BrowserStreamParent* sp =
         static_cast<BrowserStreamParent*>(static_cast<AStream*>(s->pdata));
-    if (sp->mNPP != ip || s != sp->mStream) {
+    if (sp && (sp->mNPP != ip || s != sp->mStream)) {
         NS_RUNTIMEABORT("Corrupted plugin stream data.");
     }
     return sp;
 }
 
 bool
 PluginModuleParent::HasRequiredFunctions()
 {