Title: [283338] branches/safari-612.2.9.1-branch/Source/WebKit
Revision
283338
Author
repst...@apple.com
Date
2021-09-30 14:03:10 -0700 (Thu, 30 Sep 2021)

Log Message

Cherry-pick r283294. rdar://problem/83733583

    Add weakThis check in addition to null check added in r282881
    https://bugs.webkit.org/show_bug.cgi?id=231000
    <rdar://83605614>

    Patch by Alex Christensen <achristen...@webkit.org> on 2021-09-29
    Reviewed by Brady Eidson.

    r282881 made NetworkLoad::start call didCompleteWithError, which can cause the
    NetworkResourceLoader to be deleted.  It added a null check on m_networkLoad which
    sometimes reads freed memory.  This certainly isn't great, but luckily we have a way
    to check if this object has been deleted.  Let's do that.

    * NetworkProcess/NetworkResourceLoader.cpp:
    (WebKit::NetworkResourceLoader::startNetworkLoad):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283294 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612.2.9.1-branch/Source/WebKit/ChangeLog (283337 => 283338)


--- branches/safari-612.2.9.1-branch/Source/WebKit/ChangeLog	2021-09-30 21:00:19 UTC (rev 283337)
+++ branches/safari-612.2.9.1-branch/Source/WebKit/ChangeLog	2021-09-30 21:03:10 UTC (rev 283338)
@@ -1,3 +1,40 @@
+2021-09-30  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r283294. rdar://problem/83733583
+
+    Add weakThis check in addition to null check added in r282881
+    https://bugs.webkit.org/show_bug.cgi?id=231000
+    <rdar://83605614>
+    
+    Patch by Alex Christensen <achristen...@webkit.org> on 2021-09-29
+    Reviewed by Brady Eidson.
+    
+    r282881 made NetworkLoad::start call didCompleteWithError, which can cause the
+    NetworkResourceLoader to be deleted.  It added a null check on m_networkLoad which
+    sometimes reads freed memory.  This certainly isn't great, but luckily we have a way
+    to check if this object has been deleted.  Let's do that.
+    
+    * NetworkProcess/NetworkResourceLoader.cpp:
+    (WebKit::NetworkResourceLoader::startNetworkLoad):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283294 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-29  Alex Christensen  <achristen...@webkit.org>
+
+            Add weakThis check in addition to null check added in r282881
+            https://bugs.webkit.org/show_bug.cgi?id=231000
+            <rdar://83605614>
+
+            Reviewed by Brady Eidson.
+
+            r282881 made NetworkLoad::start call didCompleteWithError, which can cause the
+            NetworkResourceLoader to be deleted.  It added a null check on m_networkLoad which
+            sometimes reads freed memory.  This certainly isn't great, but luckily we have a way
+            to check if this object has been deleted.  Let's do that.
+
+            * NetworkProcess/NetworkResourceLoader.cpp:
+            (WebKit::NetworkResourceLoader::startNetworkLoad):
+
 2021-09-29  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r283209. rdar://problem/83681911

Modified: branches/safari-612.2.9.1-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (283337 => 283338)


--- branches/safari-612.2.9.1-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2021-09-30 21:00:19 UTC (rev 283337)
+++ branches/safari-612.2.9.1-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2021-09-30 21:03:10 UTC (rev 283338)
@@ -342,12 +342,13 @@
     parameters.isNavigatingToAppBoundDomain = m_parameters.isNavigatingToAppBoundDomain;
     m_networkLoad = makeUnique<NetworkLoad>(*this, &networkSession->blobRegistry(), WTFMove(parameters), *networkSession);
     
+    auto weakThis = makeWeakPtr(*this);
     if (isSynchronous())
-        m_networkLoad->start();
+        m_networkLoad->start(); // May delete this object
     else
         m_networkLoad->startWithScheduling();
 
-    if (m_networkLoad)
+    if (weakThis && m_networkLoad)
         LOADER_RELEASE_LOG("startNetworkLoad: Going to the network (description=%" PUBLIC_LOG_STRING ")", m_networkLoad->description().utf8().data());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to