Changeset 259664 in webkit
- Timestamp:
- Apr 7, 2020, 1:03:20 PM (6 years ago)
- Location:
- branches/safari-609.2.1.2-branch/Source/WebKit
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
Platform/IPC/Connection.h (modified) (1 diff)
-
Platform/SharedMemory.h (modified) (1 diff)
-
UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (modified) (4 diffs)
-
UIProcess/WebPasteboardProxy.h (modified) (1 diff)
-
UIProcess/WebPasteboardProxy.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-609.2.1.2-branch/Source/WebKit/ChangeLog
r259663 r259664 1 2020-04-07 Russell Epstein <repstein@apple.com> 2 3 Apply patch. rdar://problem/61231957 4 5 2020-04-07 David Kilzer <ddkilzer@apple.com> 6 7 Cherry-pick r258334. rdar://problem/60396294 8 9 2020-03-12 David Kilzer <ddkilzer@apple.com> 10 11 WebPasteboardProxy::SetPasteboardBufferForType should validate its `size` parameter 12 <https://webkit.org/b/208902> 13 <rdar://problem/60181117> 14 15 Reviewed by Chris Dumez. 16 17 * Platform/IPC/Connection.h: 18 (MESSAGE_CHECK_BASE): 19 - Define in terms of MESSAGE_CHECK_COMPLETION_BASE() with a 20 no-op completion handler. 21 (MESSAGE_CHECK_COMPLETION_BASE): 22 - Rename from MESSAGE_CHECK_BASE() and add completion handler 23 parameter. 24 25 * Platform/SharedMemory.h: 26 (WebKit::SharedMemory::Handle::size const): Add. 27 28 * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: 29 (MESSAGE_CHECK): 30 - Define macro to use in 31 WebPasteboardProxy::setPasteboardBufferForType(). 32 - Undefine macro at end of source file due to unified sources. 33 (WebKit::WebPasteboardProxy::setPasteboardBufferForType): 34 - Add IPC::Connection& parameter after change to 35 WebPasteboardProxy.messages.in. Use with MESSAGE_CHECK(). 36 - Validate `size` parameter using MESSAGE_CHECK(). Because 37 SharedMemory::Handle::size() returns a size_t value, we do not 38 need to check `size <= std::numeric_limits<size_t>::max()`. 39 - Add static_cast<size_t>() to size parameter to denote type 40 change. 41 * UIProcess/WebPasteboardProxy.h: 42 (WebKit::WebPasteboardProxy::setPasteboardBufferForType): 43 - Add IPC::Connection& parameter after change to 44 WebPasteboardProxy.messages.in. 45 * UIProcess/WebPasteboardProxy.messages.in: 46 (SetPasteboardBufferForType): 47 - Add 'WantsConnection' attribute to add IPC::Connection& 48 parameter to WebPasteboardProxy::setPasteboardBufferForType(). 49 1 50 2020-04-07 Alan Coon <alancoon@apple.com> 2 51 -
branches/safari-609.2.1.2-branch/Source/WebKit/Platform/IPC/Connection.h
r259663 r259664 77 77 }; 78 78 79 #define MESSAGE_CHECK_BASE(assertion, connection) do \ 79 #define MESSAGE_CHECK_BASE(assertion, connection) MESSAGE_CHECK_COMPLETION_BASE(assertion, connection, (void)0) 80 81 #define MESSAGE_CHECK_COMPLETION_BASE(assertion, connection, completion) do \ 80 82 if (!(assertion)) { \ 81 83 ASSERT(assertion); \ 82 84 (connection)->markCurrentlyDispatchedMessageAsInvalid(); \ 85 { completion; } \ 83 86 return; \ 84 87 } \ -
branches/safari-609.2.1.2-branch/Source/WebKit/Platform/SharedMemory.h
r251765 r259664 73 73 74 74 bool isNull() const; 75 76 #if OS(DARWIN) || OS(WINDOWS) 77 size_t size() const { return m_size; } 78 #endif 75 79 76 80 void clear(); -
branches/safari-609.2.1.2-branch/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm
r251421 r259664 27 27 #import "WebPasteboardProxy.h" 28 28 29 #import "Connection.h" 29 30 #import "SandboxExtension.h" 30 31 #import "WebProcessProxy.h" … … 35 36 #import <WebCore/SharedBuffer.h> 36 37 #import <wtf/URL.h> 38 39 #define MESSAGE_CHECK(assertion, completion) MESSAGE_CHECK_COMPLETION_BASE(assertion, (&connection), completion) 37 40 38 41 namespace WebKit { … … 157 160 } 158 161 159 void WebPasteboardProxy::setPasteboardBufferForType( const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(int64_t)>&& completionHandler)162 void WebPasteboardProxy::setPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(int64_t)>&& completionHandler) 160 163 { 161 164 if (handle.isNull()) 162 165 return completionHandler(PlatformPasteboard(pasteboardName).setBufferForType(0, pasteboardType)); 166 167 // SharedMemory::Handle::size() is rounded up to the nearest page. 168 MESSAGE_CHECK(size && size <= handle.size(), completionHandler(0)); 169 163 170 RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly); 164 auto buffer = SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), s ize);171 auto buffer = SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), static_cast<size_t>(size)); 165 172 completionHandler(PlatformPasteboard(pasteboardName).setBufferForType(buffer.ptr(), pasteboardType)); 166 173 } … … 255 262 256 263 } // namespace WebKit 264 265 #undef MESSAGE_CHECK -
branches/safari-609.2.1.2-branch/Source/WebKit/UIProcess/WebPasteboardProxy.h
r251421 r259664 94 94 void setPasteboardColor(const String&, const WebCore::Color&, CompletionHandler<void(int64_t)>&&); 95 95 void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, CompletionHandler<void(int64_t)>&&); 96 void setPasteboardBufferForType( const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, CompletionHandler<void(int64_t)>&&);96 void setPasteboardBufferForType(IPC::Connection&, const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, CompletionHandler<void(int64_t)>&&); 97 97 #endif 98 98 -
branches/safari-609.2.1.2-branch/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in
r252655 r259664 57 57 SetPasteboardColor(String pasteboardName, WebCore::Color color) -> (int64_t changeCount) Synchronous 58 58 SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (int64_t changeCount) Synchronous 59 SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (int64_t changeCount) Synchronous 59 SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (int64_t changeCount) Synchronous WantsConnection 60 60 #endif 61 61
Note:
See TracChangeset
for help on using the changeset viewer.