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

Changeset 259663 in webkit


Ignore:
Timestamp:
Apr 7, 2020, 1:03:17 PM (6 years ago)
Author:
Alan Coon
Message:

Apply patch. rdar://problem/61231889

Location:
branches/safari-609.2.1.2-branch/Source/WebKit
Files:
3 edited

Legend:

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

    r259662 r259663  
     12020-04-07  Alan Coon  <alancoon@apple.com>
     2
     3        Apply patch. rdar://problem/61231889
     4
     5    2020-04-07  David Kilzer  <ddkilzer@apple.com>
     6
     7            Cherry-pick r258507. rdar://problem/60500511
     8
     9        2020-03-16  David Kilzer  <ddkilzer@apple.com>
     10
     11            WebPage::GetDataSelectionForPasteboard should validate its `size` variable
     12            <https://webkit.org/b/209092>
     13            <rdar://problem/60181345>
     14
     15            Reviewed by Brent Fulgham.
     16
     17            * Platform/IPC/Connection.h:
     18            (MESSAGE_CHECK_WITH_RETURN_VALUE_BASE): Add.
     19            - Variant of MESSAGE_CHECK_BASE() that takes a return value.
     20            * UIProcess/mac/WebPageProxyMac.mm:
     21            (MESSAGE_CHECK_WITH_RETURN_VALUE): Add.
     22            (WebKit::WebPageProxy::dataSelectionForPasteboard):
     23            - Use new MESSAGE_CHECK_WITH_RETURN_VALUE() macro to update
     24              check for handle.isNull() and to add check for `size`
     25              variable.
     26            - Add static_cast<size_t>() to `size` variable to denote type
     27              change.
     28
    1292020-04-07  Russell Epstein  <repstein@apple.com>
    230
  • branches/safari-609.2.1.2-branch/Source/WebKit/Platform/IPC/Connection.h

    r253177 r259663  
    8585while (0)
    8686
     87#define MESSAGE_CHECK_WITH_RETURN_VALUE_BASE(assertion, connection, returnValue) do \
     88    if (!(assertion)) { \
     89        ASSERT(assertion); \
     90        (connection)->markCurrentlyDispatchedMessageAsInvalid(); \
     91        return (returnValue); \
     92    } \
     93while (0)
     94
    8795template<typename AsyncReplyResult> struct AsyncReplyError {
    8896    static AsyncReplyResult create() { return { }; };
  • branches/safari-609.2.1.2-branch/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

    r259489 r259663  
    3232#import "AttributedString.h"
    3333#import "ColorSpaceData.h"
     34#import "Connection.h"
    3435#import "DataReference.h"
    3536#import "EditorState.h"
     
    6869#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process().connection())
    6970#define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(checkURLReceivedFromCurrentOrPreviousWebProcess(m_process, url), m_process->connection())
     71#define MESSAGE_CHECK_WITH_RETURN_VALUE(assertion, returnValue) MESSAGE_CHECK_WITH_RETURN_VALUE_BASE(assertion, process().connection(), returnValue)
    7072
    7173@interface NSApplication ()
     
    284286    process().sendSync(Messages::WebPage::GetDataSelectionForPasteboard(pasteboardType),
    285287        Messages::WebPage::GetDataSelectionForPasteboard::Reply(handle, size), m_webPageID, messageTimeout);
    286     if (handle.isNull())
    287         return nullptr;
    288     RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
    289     return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
     288    MESSAGE_CHECK_WITH_RETURN_VALUE(!handle.isNull(), nullptr);
     289    // SharedMemory::Handle::size() is rounded up to the nearest page.
     290    MESSAGE_CHECK_WITH_RETURN_VALUE(size <= handle.size(), nullptr);
     291
     292    auto sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
     293    return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), static_cast<size_t>(size));
    290294}
    291295
Note: See TracChangeset for help on using the changeset viewer.