Bug 211002 - WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle()
Summary: WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::rea...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on: 211542
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-24 15:57 PDT by David Kilzer (:ddkilzer)
Modified: 2020-09-01 15:56 PDT (History)
6 users (show)

See Also:


Attachments
Patch v1 (2.27 KB, patch)
2020-04-24 16:02 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch (2.38 KB, patch)
2020-09-01 11:05 PDT, katherine_cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-04-24 15:57:33 PDT
WebPasteboardProxy::getPasteboardStringsForType() and WebPasteboardProxy::readURLFromPasteboard() should check return value of SharedMemory::createHandle().

<rdar://problem/60103950>
Comment 1 David Kilzer (:ddkilzer) 2020-04-24 16:02:14 PDT
Created attachment 397525 [details]
Patch v1
Comment 2 David Kilzer (:ddkilzer) 2020-04-24 18:12:55 PDT
Comment on attachment 397525 [details]
Patch v1

This code is only used on Apple platforms, so adding cq+ and ignoring build errors on GTK and WPE ports.
Comment 3 EWS 2020-04-24 18:33:02 PDT
Committed r260689: <https://trac.webkit.org/changeset/260689>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397525 [details].
Comment 4 Darin Adler 2020-04-25 10:29:56 PDT
Are we going to add WARN_UNUSED_RETURN to createHandle?
Comment 5 David Kilzer (:ddkilzer) 2020-04-26 20:16:11 PDT
(In reply to Darin Adler from comment #4)
> Are we going to add WARN_UNUSED_RETURN to createHandle?

Yes, after we fix all the individual issues.  Tracked by <rdar://problem/62274167>.
Comment 6 Darin Adler 2020-04-26 22:03:29 PDT
Great!
Comment 7 WebKit Commit Bot 2020-05-06 18:54:58 PDT
Re-opened since this is blocked by bug 211542
Comment 8 katherine_cheney 2020-09-01 11:05:44 PDT
Created attachment 407698 [details]
Patch
Comment 9 katherine_cheney 2020-09-01 11:11:04 PDT
Thanks for the review Wenson. Going to wait for EWS before I cq+.
Comment 10 David Kilzer (:ddkilzer) 2020-09-01 13:40:07 PDT
Comment on attachment 407698 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407698&action=review

> Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:217
> -    sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
> +    if (!sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly))
> +        return completionHandler({ });

To find all places where this return value should be changed (and to prevent this from being re-introduced), change this in Source/WebKit/Platform/SharedMemory.h:

    bool createHandle(Handle&, Protection);

To this:

    WARN_UNUSED_RETURN bool createHandle(Handle&, Protection);

Then fix all the warnings.  (Not necessary to do for this patch.)
Comment 11 David Kilzer (:ddkilzer) 2020-09-01 13:40:36 PDT
Comment on attachment 407698 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407698&action=review

>> Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:217
>> +        return completionHandler({ });
> 
> To find all places where this return value should be changed (and to prevent this from being re-introduced), change this in Source/WebKit/Platform/SharedMemory.h:
> 
>     bool createHandle(Handle&, Protection);
> 
> To this:
> 
>     WARN_UNUSED_RETURN bool createHandle(Handle&, Protection);
> 
> Then fix all the warnings.  (Not necessary to do for this patch.)

Aaaaaand...I should have read the comments first.  :)
Comment 12 katherine_cheney 2020-09-01 13:58:53 PDT
(In reply to David Kilzer (:ddkilzer) from comment #11)
> Comment on attachment 407698 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=407698&action=review
> 
> >> Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:217
> >> +        return completionHandler({ });
> > 
> > To find all places where this return value should be changed (and to prevent this from being re-introduced), change this in Source/WebKit/Platform/SharedMemory.h:
> > 
> >     bool createHandle(Handle&, Protection);
> > 
> > To this:
> > 
> >     WARN_UNUSED_RETURN bool createHandle(Handle&, Protection);
> > 
> > Then fix all the warnings.  (Not necessary to do for this patch.)
> 
> Aaaaaand...I should have read the comments first.  :)

It's a good reminder! I can tackle that next.
Comment 13 EWS 2020-09-01 15:56:24 PDT
Committed r266416: <https://trac.webkit.org/changeset/266416>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407698 [details].