WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
215718
PlatformPasteboard::getPathnamesForType() assumes the pasteboard type property list is an NSArray of NSStrings
https://bugs.webkit.org/show_bug.cgi?id=215718
Summary
PlatformPasteboard::getPathnamesForType() assumes the pasteboard type propert...
Kate Cheney
Reported
2020-08-20 17:03:31 PDT
This is not always the case, so we should probably handle other cases
Attachments
Patch
(5.28 KB, patch)
2020-08-20 17:11 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(5.68 KB, patch)
2020-09-08 13:17 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Kate Cheney
Comment 1
2020-08-20 17:04:00 PDT
<
rdar://problem/67505327
>
Kate Cheney
Comment 2
2020-08-20 17:11:01 PDT
Created
attachment 406979
[details]
Patch
Radar WebKit Bug Importer
Comment 3
2020-08-27 17:09:49 PDT
<
rdar://problem/67906582
>
Kate Cheney
Comment 4
2020-09-08 13:17:01 PDT
Created
attachment 408262
[details]
Patch
Darin Adler
Comment 5
2020-09-08 13:25:01 PDT
Comment on
attachment 408262
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=408262&action=review
> Source/WebCore/platform/mac/PlatformPasteboardMac.mm:113 > + if ([[paths objectAtIndex:0] isKindOfClass:[NSArray class]]) { > + [paths enumerateObjectsUsingBlock:^(NSArray *plistEntry, NSUInteger, BOOL *) { > + pathnames.appendVector(makeVector<String>(plistEntry)); > + }]; > + return; > + }
This is very interesting. What is the semantics of this array of arrays? Why is it correct to flatten out this array of arrays into a single vector of strings? Are all the strings in all these arrays pathnames? Why is this structured that way? (Separately, sadly appendVector(makeVector) is not particularly efficient, and we might want to improve that later.)
Kate Cheney
Comment 6
2020-09-08 13:43:06 PDT
(In reply to Darin Adler from
comment #5
)
> Comment on
attachment 408262
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=408262&action=review
> > > Source/WebCore/platform/mac/PlatformPasteboardMac.mm:113 > > + if ([[paths objectAtIndex:0] isKindOfClass:[NSArray class]]) { > > + [paths enumerateObjectsUsingBlock:^(NSArray *plistEntry, NSUInteger, BOOL *) { > > + pathnames.appendVector(makeVector<String>(plistEntry)); > > + }]; > > + return; > > + } > > This is very interesting. What is the semantics of this array of arrays? Why > is it correct to flatten out this array of arrays into a single vector of > strings? Are all the strings in all these arrays pathnames? Why is this > structured that way?
I noticed this while investigating another bug, but haven't actually been able to reproduce any user-facing impact (trying now). I thought it was strange that WebKit itself sets property lists of NSArrays of NSArrays but here assumes the type is an NSArray of NSStrings. Maybe we don't care about that case in PlatformPasteboard::getPathnamesForType().
> > (Separately, sadly appendVector(makeVector) is not particularly efficient, > and we might want to improve that later.)
Noted, I did not know it was inefficient.
Kate Cheney
Comment 7
2020-09-08 14:06:03 PDT
(In reply to katherine_cheney from
comment #6
)
> (In reply to Darin Adler from
comment #5
) > > Comment on
attachment 408262
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=408262&action=review
> > > > > Source/WebCore/platform/mac/PlatformPasteboardMac.mm:113 > > > + if ([[paths objectAtIndex:0] isKindOfClass:[NSArray class]]) { > > > + [paths enumerateObjectsUsingBlock:^(NSArray *plistEntry, NSUInteger, BOOL *) { > > > + pathnames.appendVector(makeVector<String>(plistEntry)); > > > + }]; > > > + return; > > > + } > > > > This is very interesting. What is the semantics of this array of arrays? Why > > is it correct to flatten out this array of arrays into a single vector of > > strings? Are all the strings in all these arrays pathnames? Why is this > > structured that way? > > I noticed this while investigating another bug, but haven't actually been > able to reproduce any user-facing impact (trying now). I thought it was > strange that WebKit itself sets property lists of NSArrays of NSArrays but > here assumes the type is an NSArray of NSStrings. Maybe we don't care about > that case in PlatformPasteboard::getPathnamesForType(). >
Actually, looking at other parts of the code, you're right. PlatformPasteboard::getPathnamesForType() should only need to handle the case of NSArray of NSStrings, because the NSArray of NSArray case is not pathname-related. Closing this bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug