Changeset 260689 in webkit


Ignore:
Timestamp:
Apr 24, 2020 6:32:58 PM (4 years ago)
Author:
ddkilzer@apple.com
Message:

WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()
<https://webkit.org/b/211002>

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

    r260684 r260689  
     12020-04-24  David Kilzer  <ddkilzer@apple.com>
     2
     3        WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()
     4        <https://webkit.org/b/211002>
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
     9        (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
     10        (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
     11        - Check result of SharedMemory::createHandle() and return early
     12          on failure.
     13
    1142020-04-24  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm

    r260429 r260689  
    186186    memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
    187187    SharedMemory::Handle handle;
    188     sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
     188    if (!sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly))
     189        return completionHandler({ }, 0);
    189190    completionHandler(WTFMove(handle), size);
    190191}
     
    388389    memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
    389390    SharedMemory::Handle handle;
    390     sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
     391    if (!sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly))
     392        return completionHandler({ }, 0);
    391393    completionHandler(WTFMove(handle), size);
    392394}
Note: See TracChangeset for help on using the changeset viewer.