WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
206055
Decoding an SVG off the main thread causes a crash
https://bugs.webkit.org/show_bug.cgi?id=206055
Summary
Decoding an SVG off the main thread causes a crash
Chris Lord
Reported
2020-01-10 02:26:14 PST
If you decode an SVG off the main thread via ImageBitmap, this results in a crash. You can test this by enabling offscreen-canvas and running either of these two tests: imported/w3c/web-platform-tests/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.svg.worker.html imported/w3c/web-platform-tests/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.zerosource.image.worker.html
Attachments
Patch
(6.74 KB, patch)
2021-04-30 05:09 PDT
,
Chris Lord
no flags
Details
Formatted Diff
Diff
Patch
(6.99 KB, patch)
2021-05-03 01:33 PDT
,
Chris Lord
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2020-01-13 11:05:20 PST
None of the SVG code is thread safe. You'll need to bounce to the main thread for SVG.
Chris Lord
Comment 2
2021-04-30 05:09:54 PDT
Created
attachment 427409
[details]
Patch
Chris Lord
Comment 3
2021-04-30 06:40:10 PDT
Comment on
attachment 427409
[details]
Patch ImageBitmap obviously doesn't need an actual SVG document, it was only using Image to get the bitmap data. Instead, use BitmapImage directly and bypass the SVG and PDF document image loaders.
Darin Adler
Comment 4
2021-04-30 10:33:11 PDT
Comment on
attachment 427409
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=427409&action=review
> Source/WebCore/html/ImageBitmap.cpp:739 > + auto image = BitmapImage::create(&observer.get());
The better idiom here is observer.ptr().
> Source/WebCore/html/ImageBitmap.cpp:760 > + bitmapData->context().drawImage(image.get(), destRect, sourceRectangle.releaseReturnValue(), { interpolationQualityForResizeQuality(options.resizeQuality), imageOrientationForOrientation(options.imageOrientation) });
Not sure we need ".get()" here. Ref typically converts itself to a reference when passing it as an argument.
> Source/WebCore/svg/graphics/SVGImage.cpp:83 > + ASSERT(isMainThread());
Consider also having this assertion in Image::create itself? The assertion without a comment seems a little mysterious; not that I’d want a long comment.
Chris Lord
Comment 5
2021-05-03 01:33:46 PDT
Created
attachment 427544
[details]
Patch
EWS
Comment 6
2021-05-03 02:29:58 PDT
Committed
r276895
(
237241@main
): <
https://commits.webkit.org/237241@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 427544
[details]
.
Radar WebKit Bug Importer
Comment 7
2021-05-03 02:30:18 PDT
<
rdar://problem/77448836
>
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