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

Changeset 246648 in webkit


Ignore:
Timestamp:
Jun 20, 2019, 1:06:49 PM (7 years ago)
Author:
Kocsen Chung
Message:

Cherry-pick r245911. rdar://problem/51656609

Network process crash when decoding SecItemResponseData
https://bugs.webkit.org/show_bug.cgi?id=198388
<rdar://problem/50408046>

Reviewed by Alex Christensen.

  • Shared/cf/ArgumentCodersCF.cpp: (IPC::decode): When decoding the elements inside a CFArrayRef, if decoding was successful but the CFTypeRef element is still null then skip it instead of trying to append it to the array. A CFArray container is not allowed to contain null. Some of our decoders for CFTypeRef types may not initialize the element even if the decode() function returns true. For example, the decoders for CFArrayRef and CFDictionaryRef return true if the encoded container was null but do not create a container.
  • Shared/mac/SecItemResponseData.cpp: (WebKit::SecItemResponseData::SecItemResponseData): nit: The wrong parameter was being moved. This is more efficient.

(WebKit::SecItemResponseData::encode const):
nit: Drop unnecessary .get().

  • UIProcess/mac/SecItemShimProxy.cpp: (WebKit::SecItemShimProxy::secItemRequest): nit: Use nullptr instead of 0.

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

Location:
branches/safari-607-branch/Source/WebKit
Files:
4 edited

Legend:

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

    r246377 r246648  
     12019-06-19  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r245911. rdar://problem/51656609
     4
     5    Network process crash when decoding SecItemResponseData
     6    https://bugs.webkit.org/show_bug.cgi?id=198388
     7    <rdar://problem/50408046>
     8   
     9    Reviewed by Alex Christensen.
     10   
     11    * Shared/cf/ArgumentCodersCF.cpp:
     12    (IPC::decode):
     13    When decoding the elements inside a CFArrayRef, if decoding was successful but
     14    the CFTypeRef element is still null then skip it instead of trying to append it
     15    to the array. A CFArray container is not allowed to contain null.
     16    Some of our decoders for CFTypeRef types may not initialize the element even if
     17    the decode() function returns true. For example, the decoders for CFArrayRef and
     18    CFDictionaryRef return true if the encoded container was null but do not create
     19    a container.
     20   
     21    * Shared/mac/SecItemResponseData.cpp:
     22    (WebKit::SecItemResponseData::SecItemResponseData):
     23    nit: The wrong parameter was being moved. This is more efficient.
     24   
     25    (WebKit::SecItemResponseData::encode const):
     26    nit: Drop unnecessary .get().
     27   
     28    * UIProcess/mac/SecItemShimProxy.cpp:
     29    (WebKit::SecItemShimProxy::secItemRequest):
     30    nit: Use nullptr instead of 0.
     31   
     32    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     33
     34    2019-05-30  Chris Dumez  <cdumez@apple.com>
     35
     36            Network process crash when decoding SecItemResponseData
     37            https://bugs.webkit.org/show_bug.cgi?id=198388
     38            <rdar://problem/50408046>
     39
     40            Reviewed by Alex Christensen.
     41
     42            * Shared/cf/ArgumentCodersCF.cpp:
     43            (IPC::decode):
     44            When decoding the elements inside a CFArrayRef, if decoding was successful but
     45            the CFTypeRef element is still null then skip it instead of trying to append it
     46            to the array. A CFArray container is not allowed to contain null.
     47            Some of our decoders for CFTypeRef types may not initialize the element even if
     48            the decode() function returns true. For example, the decoders for CFArrayRef and
     49            CFDictionaryRef return true if the encoded container was null but do not create
     50            a container.
     51
     52            * Shared/mac/SecItemResponseData.cpp:
     53            (WebKit::SecItemResponseData::SecItemResponseData):
     54            nit: The wrong parameter was being moved. This is more efficient.
     55
     56            (WebKit::SecItemResponseData::encode const):
     57            nit: Drop unnecessary .get().
     58
     59            * UIProcess/mac/SecItemShimProxy.cpp:
     60            (WebKit::SecItemShimProxy::secItemRequest):
     61            nit: Use nullptr instead of 0.
     62
    1632019-06-12  Null  <null@apple.com>
    264
  • branches/safari-607-branch/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp

    r244255 r246648  
    347347        return false;
    348348
    349     RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
     349    auto array = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
    350350
    351351    for (size_t i = 0; i < size; ++i) {
     
    354354            return false;
    355355
     356        if (!element)
     357            continue;
     358       
    356359        CFArrayAppendValue(array.get(), element.get());
    357360    }
  • branches/safari-607-branch/Source/WebKit/Shared/mac/SecItemResponseData.cpp

    r204668 r246648  
    4545{
    4646    encoder << static_cast<int64_t>(m_resultCode);
    47     encoder << static_cast<bool>(m_resultObject.get());
     47    encoder << static_cast<bool>(m_resultObject);
    4848    if (m_resultObject)
    4949        IPC::encode(encoder, m_resultObject.get());
  • branches/safari-607-branch/Source/WebKit/UIProcess/mac/SecItemShimProxy.cpp

    r232990 r246648  
    6666    case SecItemRequestData::Invalid:
    6767        LOG_ERROR("SecItemShimProxy::secItemRequest received an invalid data request. Please file a bug if you know how you caused this.");
    68         response = SecItemResponseData(errSecParam, nullptr);
     68        response = SecItemResponseData { errSecParam, nullptr };
    6969        break;
    7070
    7171    case SecItemRequestData::CopyMatching: {
    72         CFTypeRef resultObject = 0;
     72        CFTypeRef resultObject = nullptr;
    7373        OSStatus resultCode = SecItemCopyMatching(request.query(), &resultObject);
    74         response = SecItemResponseData(resultCode, adoptCF(resultObject).get());
     74        response = SecItemResponseData { resultCode, adoptCF(resultObject).get() };
    7575        break;
    7676    }
     
    8080        // serialize SecKeychainItemRef.
    8181        OSStatus resultCode = SecItemAdd(request.query(), nullptr);
    82         response = SecItemResponseData(resultCode, nullptr);
     82        response = SecItemResponseData { resultCode, nullptr };
    8383        break;
    8484    }
     
    8686    case SecItemRequestData::Update: {
    8787        OSStatus resultCode = SecItemUpdate(request.query(), request.attributesToMatch());
    88         response = SecItemResponseData(resultCode, 0);
     88        response = SecItemResponseData { resultCode, nullptr };
    8989        break;
    9090    }
     
    9292    case SecItemRequestData::Delete: {
    9393        OSStatus resultCode = SecItemDelete(request.query());
    94         response = SecItemResponseData(resultCode, 0);
     94        response = SecItemResponseData { resultCode, nullptr };
    9595        break;
    9696    }
Note: See TracChangeset for help on using the changeset viewer.