⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283338 in webkit


Ignore:
Timestamp:
Sep 30, 2021, 2:03:10 PM (5 years ago)
Author:
Russell Epstein
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 <achristensen@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

Location:
branches/safari-612.2.9.1-branch/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.2.9.1-branch/Source/WebKit/ChangeLog

    r283246 r283338  
     12021-09-30  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r283294. rdar://problem/83733583
     4
     5    Add weakThis check in addition to null check added in r282881
     6    https://bugs.webkit.org/show_bug.cgi?id=231000
     7    <rdar://83605614>
     8   
     9    Patch by Alex Christensen <achristensen@webkit.org> on 2021-09-29
     10    Reviewed by Brady Eidson.
     11   
     12    r282881 made NetworkLoad::start call didCompleteWithError, which can cause the
     13    NetworkResourceLoader to be deleted.  It added a null check on m_networkLoad which
     14    sometimes reads freed memory.  This certainly isn't great, but luckily we have a way
     15    to check if this object has been deleted.  Let's do that.
     16   
     17    * NetworkProcess/NetworkResourceLoader.cpp:
     18    (WebKit::NetworkResourceLoader::startNetworkLoad):
     19   
     20    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283294 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     21
     22    2021-09-29  Alex Christensen  <achristensen@webkit.org>
     23
     24            Add weakThis check in addition to null check added in r282881
     25            https://bugs.webkit.org/show_bug.cgi?id=231000
     26            <rdar://83605614>
     27
     28            Reviewed by Brady Eidson.
     29
     30            r282881 made NetworkLoad::start call didCompleteWithError, which can cause the
     31            NetworkResourceLoader to be deleted.  It added a null check on m_networkLoad which
     32            sometimes reads freed memory.  This certainly isn't great, but luckily we have a way
     33            to check if this object has been deleted.  Let's do that.
     34
     35            * NetworkProcess/NetworkResourceLoader.cpp:
     36            (WebKit::NetworkResourceLoader::startNetworkLoad):
     37
    1382021-09-29  Alan Coon  <alancoon@apple.com>
    239
  • branches/safari-612.2.9.1-branch/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp

    r282986 r283338  
    343343    m_networkLoad = makeUnique<NetworkLoad>(*this, &networkSession->blobRegistry(), WTFMove(parameters), *networkSession);
    344344   
     345    auto weakThis = makeWeakPtr(*this);
    345346    if (isSynchronous())
    346         m_networkLoad->start();
     347        m_networkLoad->start(); // May delete this object
    347348    else
    348349        m_networkLoad->startWithScheduling();
    349350
    350     if (m_networkLoad)
     351    if (weakThis && m_networkLoad)
    351352        LOADER_RELEASE_LOG("startNetworkLoad: Going to the network (description=%" PUBLIC_LOG_STRING ")", m_networkLoad->description().utf8().data());
    352353}
Note: See TracChangeset for help on using the changeset viewer.