WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 225183
Handle case where decoding of image lead to an empty one.
https://bugs.webkit.org/show_bug.cgi?id=225183
Summary
Handle case where decoding of image lead to an empty one.
Jean-Yves Avenard [:jya]
Reported
2021-04-28 20:23:37 PDT
Handle case where decoding of image lead to an empty one.
Attachments
Patch
(1.69 KB, patch)
2021-04-28 20:48 PDT
,
Jean-Yves Avenard [:jya]
no flags
Details
Formatted Diff
Diff
Patch
(3.87 KB, patch)
2021-04-28 21:10 PDT
,
Jean-Yves Avenard [:jya]
no flags
Details
Formatted Diff
Diff
Patch
(2.73 KB, patch)
2021-04-29 17:57 PDT
,
Jean-Yves Avenard [:jya]
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Jean-Yves Avenard [:jya]
Comment 1
2021-04-28 20:25:22 PDT
rdar://77251937
Jean-Yves Avenard [:jya]
Comment 2
2021-04-28 20:48:00 PDT
Created
attachment 427327
[details]
Patch
Jean-Yves Avenard [:jya]
Comment 3
2021-04-28 21:10:42 PDT
Created
attachment 427328
[details]
Patch
Eric Carlson
Comment 4
2021-04-29 10:09:57 PDT
Comment on
attachment 427328
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427328&action=review
> Source/WebCore/Modules/mediasession/MediaMetadata.cpp:184 > + // Empty image; ignore.
Nit: I don't think this comment is necessary.
> Source/WebCore/html/MediaElementSession.cpp:1160 > + ASSERT(sessionMetadata->artworkImage()->data()); > artwork = NowPlayingInfoArtwork { sessionMetadata->artworkSrc(), sessionMetadata->artworkImage()->mimeType(), sessionMetadata->artworkImage()->data() };
Is there any reason to create the artwork if `sessionMetadata->artworkImage()->data()` is NULL?
> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:314 > + ASSERT(nowPlayingInfo.artwork->imageData); > auto nsArtwork = nowPlayingInfo.artwork->imageData->createNSData();
This will crash in a release build, so either the assert isn't necessary or we should not try to create the artwork if the image data is NULL.
Jean-Yves Avenard [:jya]
Comment 5
2021-04-29 17:26:55 PDT
Comment on
attachment 427328
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427328&action=review
>> Source/WebCore/html/MediaElementSession.cpp:1160 >> artwork = NowPlayingInfoArtwork { sessionMetadata->artworkSrc(), sessionMetadata->artworkImage()->mimeType(), sessionMetadata->artworkImage()->data() }; > > Is there any reason to create the artwork if `sessionMetadata->artworkImage()->data()` is NULL?
This is the point of the assert. An Image received here *must* have a SharedBuffer attached. It is an error if there's not. This is the core of the change. But Jer suggested I use a Ref rather than a RefPtr in NowPlayingInfoArtwork structure, however the code relies on the ability to set the value to a null pointer to indicate that the cached image should be used instead. So it would need to be made an Optional<Ref<SharedBuffer>> which is pretty much what a RefPtr is.
Jean-Yves Avenard [:jya]
Comment 6
2021-04-29 17:57:15 PDT
Created
attachment 427393
[details]
Patch
EWS
Comment 7
2021-04-29 18:42:27 PDT
Committed
r276827
(
237182@main
): <
https://commits.webkit.org/237182@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 427393
[details]
.
Eric Carlson
Comment 8
2021-04-30 07:49:37 PDT
(In reply to Jean-Yves Avenard [:jya] from
comment #5
)
> Comment on
attachment 427328
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=427328&action=review
> > >> Source/WebCore/html/MediaElementSession.cpp:1160 > >> artwork = NowPlayingInfoArtwork { sessionMetadata->artworkSrc(), sessionMetadata->artworkImage()->mimeType(), sessionMetadata->artworkImage()->data() }; > > > > Is there any reason to create the artwork if `sessionMetadata->artworkImage()->data()` is NULL? > > This is the point of the assert. An Image received here *must* have a > SharedBuffer attached. It is an error if there's not. > > This is the core of the change.
Right. My point was that NowPlayingInfoArtwork without image data is useless, ASSERTing in a debug build is good but why create the NowPlayingInfoArtwork in a release build?
Jean-Yves Avenard [:jya]
Comment 9
2021-04-30 15:19:16 PDT
Comment on
attachment 427328
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427328&action=review
>>>> Source/WebCore/html/MediaElementSession.cpp:1160 >>>> artwork = NowPlayingInfoArtwork { sessionMetadata->artworkSrc(), sessionMetadata->artworkImage()->mimeType(), sessionMetadata->artworkImage()->data() }; >>> >>> Is there any reason to create the artwork if `sessionMetadata->artworkImage()->data()` is NULL? >> >> This is the point of the assert. An Image received here *must* have a SharedBuffer attached. It is an error if there's not. >> >> This is the core of the change. >> >> But Jer suggested I use a Ref rather than a RefPtr in NowPlayingInfoArtwork structure, however the code relies on the ability to set the value to a null pointer to indicate that the cached image should be used instead. So it would need to be made an Optional<Ref<SharedBuffer>> which is pretty much what a RefPtr is. > > Right. My point was that NowPlayingInfoArtwork without image data is useless, ASSERTing in a debug build is good but why create the NowPlayingInfoArtwork in a release build?
And it won’t be. As artwork will not be set if the image as no data following this change.
Eric Carlson
Comment 10
2021-04-30 16:40:25 PDT
(In reply to Jean-Yves Avenard [:jya] from
comment #9
)
> > Right. My point was that NowPlayingInfoArtwork without image data is useless, ASSERTing in a debug build is good but why create the NowPlayingInfoArtwork in a release build? > > And it won’t be. As artwork will not be set if the image as no data > following this change.
Sorry, I am not being very clear. I was trying to say that there is no need to create the `Optional<NowPlayingInfoArtwork>` if we don't have image data, because that means we will also serialize and then deserialize it only to find out we can't use it.
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