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

Changeset 254588 in webkit


Ignore:
Timestamp:
Jan 15, 2020, 11:14:42 AM (7 years ago)
Author:
Alan Coon
Message:

Cherry-pick r254092. rdar://problem/58552872

NetworkSessionCocoa::isolatedSession should not use iterator after mutating m_isolatedSessions
​https://bugs.webkit.org/show_bug.cgi?id=205824
<rdar://problem/55107625>

Patch by Alex Christensen <​achristensen@webkit.org> on 2020-01-06
Reviewed by Chris Dumez.

Classic iterator use after mutating iterated container was causing crashes by returning a null SessionWrapper&
This was introduced in r252185 or r248640.

  • NetworkProcess/cocoa/NetworkSessionCocoa.mm: (WebKit::NetworkSessionCocoa::isolatedSession):

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

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

Legend:

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

    r254587 r254588  
     12020-01-14  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r254092. rdar://problem/58552872
     4
     5    NetworkSessionCocoa::isolatedSession should not use iterator after mutating m_isolatedSessions
     6    https://bugs.webkit.org/show_bug.cgi?id=205824
     7    <rdar://problem/55107625>
     8   
     9    Patch by Alex Christensen <achristensen@webkit.org> on 2020-01-06
     10    Reviewed by Chris Dumez.
     11   
     12    Classic iterator use after mutating iterated container was causing crashes by returning a null SessionWrapper&
     13    This was introduced in r252185 or r248640.
     14   
     15    * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     16    (WebKit::NetworkSessionCocoa::isolatedSession):
     17   
     18    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254092 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     19
     20    2020-01-06  Alex Christensen  <achristensen@webkit.org>
     21
     22            NetworkSessionCocoa::isolatedSession should not use iterator after mutating m_isolatedSessions
     23            https://bugs.webkit.org/show_bug.cgi?id=205824
     24            <rdar://problem/55107625>
     25
     26            Reviewed by Chris Dumez.
     27
     28            Classic iterator use after mutating iterated container was causing crashes by returning a null SessionWrapper&
     29            This was introduced in r252185 or r248640.
     30
     31            * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     32            (WebKit::NetworkSessionCocoa::isolatedSession):
     33
    1342020-01-14  Alan Coon  <alancoon@apple.com>
    235
  • branches/safari-609-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r253642 r254588  
    11951195    entry->lastUsed = WallTime::now();
    11961196
     1197    auto& sessionWrapper = [&] (auto storedCredentialsPolicy) -> SessionWrapper& {
     1198        switch (storedCredentialsPolicy) {
     1199        case WebCore::StoredCredentialsPolicy::Use:
     1200            LOG(NetworkSession, "Using isolated NSURLSession with credential storage.");
     1201            return entry->sessionWithCredentialStorage;
     1202        case WebCore::StoredCredentialsPolicy::DoNotUse:
     1203            LOG(NetworkSession, "Using isolated NSURLSession without credential storage.");
     1204            return entry->sessionWithoutCredentialStorage;
     1205        case WebCore::StoredCredentialsPolicy::EphemeralStateless:
     1206            if (!m_ephemeralStatelessSession.session)
     1207                initializeEphemeralStatelessSession();
     1208            return m_ephemeralStatelessSession;
     1209        }
     1210    } (storedCredentialsPolicy);
     1211   
    11971212    if (m_isolatedSessions.size() > maxNumberOfIsolatedSessions) {
    11981213        WebCore::RegistrableDomain keyToRemove;
    … …  
    12111226    RELEASE_ASSERT(m_isolatedSessions.size() <= maxNumberOfIsolatedSessions);
    12121227
    1213     switch (storedCredentialsPolicy) {
    1214     case WebCore::StoredCredentialsPolicy::Use:
    1215         LOG(NetworkSession, "Using isolated NSURLSession with credential storage.");
    1216         return entry->sessionWithCredentialStorage;
    1217     case WebCore::StoredCredentialsPolicy::DoNotUse:
    1218         LOG(NetworkSession, "Using isolated NSURLSession without credential storage.");
    1219         return entry->sessionWithoutCredentialStorage;
    1220     case WebCore::StoredCredentialsPolicy::EphemeralStateless:
    1221         if (!m_ephemeralStatelessSession.session)
    1222             initializeEphemeralStatelessSession();
    1223         return m_ephemeralStatelessSession;
    1224     }
     1228    return sessionWrapper;
    12251229}
    12261230
Note: See TracChangeset for help on using the changeset viewer.