Bug 1554976 - Move thread assertion inside if statement in OnLookupComplete; r=mjf
☠☠ backed out by 5b1d527eacfc ☠ ☠
authorDan Minor <dminor@mozilla.com>
Wed, 28 Aug 2019 13:12:13 +0000
changeset 554155 27b4dddf9597df076caad414b27f70ba8dbc7245
parent 554154 3e16c10bb9660db569563792cbbb21083bf41391
child 554156 a9b209d9d880443578f19dfc1de4bf1a92b37ba4
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjf
bugs1554976
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1554976 - Move thread assertion inside if statement in OnLookupComplete; r=mjf Checking this assertion outside of the if statement can result in a use-after-free in debug builds. Differential Revision: https://phabricator.services.mozilla.com/D42152
media/webrtc/signaling/src/peerconnection/MediaTransportHandler.cpp
--- a/media/webrtc/signaling/src/peerconnection/MediaTransportHandler.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaTransportHandler.cpp
@@ -1430,19 +1430,18 @@ void MediaTransportHandlerSTS::Encrypted
                                                       MediaPacket& aPacket) {
   OnEncryptedSending(aLayer->flow_id(), aPacket);
 }
 
 NS_IMPL_ISUPPORTS(MediaTransportHandlerSTS::DNSListener, nsIDNSListener);
 
 nsresult MediaTransportHandlerSTS::DNSListener::OnLookupComplete(
     nsICancelable* aRequest, nsIDNSRecord* aRecord, nsresult aStatus) {
-  MOZ_ASSERT(mTransportHandler.mStsThread->IsOnCurrentThread());
-
   if (mCancel) {
+    MOZ_ASSERT(mTransportHandler.mStsThread->IsOnCurrentThread());
     if (NS_SUCCEEDED(aStatus)) {
       nsTArray<net::NetAddr> addresses;
       aRecord->GetAddresses(addresses);
 
       // https://tools.ietf.org/html/draft-ietf-rtcweb-mdns-ice-candidates-03#section-3.2.2
       if (addresses.Length() == 1) {
         char buf[net::kIPv6CStrBufSize];
         if (!net::NetAddrToString(&addresses[0], buf, sizeof(buf))) {