Title: [283684] branches/safari-612-branch/Source/WebKit
Revision
283684
Author
[email protected]
Date
2021-10-06 17:32:40 -0700 (Wed, 06 Oct 2021)

Log Message

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

    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 <[email protected]> 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-branch/Source/WebKit/ChangeLog (283683 => 283684)


--- branches/safari-612-branch/Source/WebKit/ChangeLog	2021-10-07 00:32:36 UTC (rev 283683)
+++ branches/safari-612-branch/Source/WebKit/ChangeLog	2021-10-07 00:32:40 UTC (rev 283684)
@@ -1,3 +1,40 @@
+2021-10-06  Russell Epstein  <[email protected]>
+
+        Cherry-pick r283294. rdar://problem/83956654
+
+    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 <[email protected]> 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  <[email protected]>
+
+            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-28  Alan Coon  <[email protected]>
 
         Cherry-pick r283156. rdar://problem/83648190

Modified: branches/safari-612-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (283683 => 283684)


--- branches/safari-612-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2021-10-07 00:32:36 UTC (rev 283683)
+++ branches/safari-612-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2021-10-07 00:32:40 UTC (rev 283684)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to