Bug 1469879 - Add check for closed socket on Multicast IPC parent funcs. r=baku, a=lizzard
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 25 Jun 2018 16:59:08 -0700
changeset 477808 a1992e3234f46097648c27175d2ac8b540f561df
parent 477807 187686c0fc83b263b03659edbc1b5051d7df1936
child 477809 6ce7f5a3eaf3e8935f8d6b9c60b3a3fd8558828b
push id9432
push userryanvm@gmail.com
push dateWed, 04 Jul 2018 00:21:37 +0000
treeherdermozilla-beta@505d8765ce63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, lizzard
bugs1469879
milestone62.0
Bug 1469879 - Add check for closed socket on Multicast IPC parent funcs. r=baku, a=lizzard MozReview-Commit-ID: CaNYPtgFz87
dom/network/UDPSocketParent.cpp
--- a/dom/network/UDPSocketParent.cpp
+++ b/dom/network/UDPSocketParent.cpp
@@ -445,29 +445,41 @@ UDPSocketParent::Send(const IPCStream& a
     FireInternalError(__LINE__);
   }
 }
 
 mozilla::ipc::IPCResult
 UDPSocketParent::RecvJoinMulticast(const nsCString& aMulticastAddress,
                                    const nsCString& aInterface)
 {
+  if (!mSocket) {
+    NS_WARNING("multicast socket is closed");
+    FireInternalError(__LINE__);
+    return IPC_OK();
+  }
+
   nsresult rv = mSocket->JoinMulticast(aMulticastAddress, aInterface);
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     FireInternalError(__LINE__);
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 UDPSocketParent::RecvLeaveMulticast(const nsCString& aMulticastAddress,
                                     const nsCString& aInterface)
 {
+  if (!mSocket) {
+    NS_WARNING("multicast socket is closed");
+    FireInternalError(__LINE__);
+    return IPC_OK();
+  }
+
   nsresult rv = mSocket->LeaveMulticast(aMulticastAddress, aInterface);
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     FireInternalError(__LINE__);
   }
 
   return IPC_OK();
 }