Bug 230187 - [Cocoa] Drawing the rounded system ui font into canvas causes a crash
Summary: [Cocoa] Drawing the rounded system ui font into canvas causes a crash
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-11 01:56 PDT by Myles C. Maxfield
Modified: 2021-09-13 12:52 PDT (History)
2 users (show)

See Also:


Attachments
Patch (8.32 KB, patch)
2021-09-11 01:59 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (7.12 KB, patch)
2021-09-11 16:52 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (7.12 KB, patch)
2021-09-11 18:15 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (7.12 KB, patch)
2021-09-11 18:16 PDT, Myles C. Maxfield
wenson_hsieh: review+
Details | Formatted Diff | Diff
Fix leak (1.66 KB, patch)
2021-09-13 09:57 PDT, Wenson Hsieh
mmaxfield: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2021-09-11 01:56:51 PDT
[Cocoa] Drawing the rounded system ui font into canvas causes a crash
Comment 1 Myles C. Maxfield 2021-09-11 01:59:36 PDT
Created attachment 437945 [details]
Patch
Comment 2 Myles C. Maxfield 2021-09-11 01:59:38 PDT
<rdar://problem/81436658>
Comment 3 Myles C. Maxfield 2021-09-11 16:52:36 PDT
Created attachment 437972 [details]
Patch
Comment 4 Myles C. Maxfield 2021-09-11 18:15:42 PDT
Created attachment 437974 [details]
Patch
Comment 5 Myles C. Maxfield 2021-09-11 18:16:36 PDT
Created attachment 437975 [details]
Patch
Comment 6 Wenson Hsieh 2021-09-12 11:43:51 PDT
Comment on attachment 437975 [details]
Patch

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

> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:517
>      if (!fontDescriptor)
>          return nullptr;

What do you think about using `CTFontDescriptorCreateLastResort()` here as a sort of failsafe (perhaps with an `ASSERT_NOT_REACHED` so that we're still able to catch instances where we would've otherwise failed to decode)?
Comment 7 Myles C. Maxfield 2021-09-12 19:24:26 PDT
Comment on attachment 437975 [details]
Patch

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

>> Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:517
>>          return nullptr;
> 
> What do you think about using `CTFontDescriptorCreateLastResort()` here as a sort of failsafe (perhaps with an `ASSERT_NOT_REACHED` so that we're still able to catch instances where we would've otherwise failed to decode)?

That is a good idea!
Comment 8 Myles C. Maxfield 2021-09-12 20:23:08 PDT
Committed r282320 (241590@main): <https://commits.webkit.org/241590@main>
Comment 9 Wenson Hsieh 2021-09-13 09:57:55 PDT
Reopening to attach new patch.
Comment 10 Wenson Hsieh 2021-09-13 09:57:56 PDT
Created attachment 438049 [details]
Fix leak
Comment 11 Myles C. Maxfield 2021-09-13 12:41:26 PDT
Committed r282349 (241615@main): <https://commits.webkit.org/241615@main>