Changeset 266416 in webkit


Ignore:
Timestamp:
Sep 1, 2020 3:56:19 PM (4 years ago)
Author:
Kate Cheney
Message:

WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()
https://bugs.webkit.org/show_bug.cgi?id=211002
<rdar://problem/60103950>

Reviewed by Wenson Hsieh.

  • UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:

(WebKit::WebPasteboardProxy::getPasteboardBufferForType):
(WebKit::WebPasteboardProxy::readBufferFromPasteboard):
Check result of SharedMemory::createHandle() and return early
on failure.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r266412 r266416  
     12020-09-01  Kate Cheney  <katherine_cheney@apple.com>
     2
     3        WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()
     4        https://bugs.webkit.org/show_bug.cgi?id=211002
     5        <rdar://problem/60103950>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
     10        (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
     11        (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
     12        Check result of SharedMemory::createHandle() and return early
     13        on failure.
     14
    1152020-09-01  Hector Lopez  <hector_i_lopez@apple.com>
    216
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm

    r265702 r266416  
    214214    memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
    215215    SharedMemory::Handle handle;
    216     sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
     216    if (!sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly))
     217        return completionHandler({ });
    217218    completionHandler(SharedMemory::IPCHandle { WTFMove(handle), size });
    218219}
     
    431432    memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
    432433    SharedMemory::Handle handle;
    433     sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
     434    if (!sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly))
     435        return completionHandler({ });
    434436    completionHandler(SharedMemory::IPCHandle { WTFMove(handle), size });
    435437}
Note: See TracChangeset for help on using the changeset viewer.