[webkit-changes] [WebKit/WebKit] 3d0b28: REGRESSION (275396 at main): [iOS] Safari sometimes c...
Wenson Hsieh
noreply at github.com
Tue Jun 11 06:32:45 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3d0b28687be1fcb0a39e95db941f1742d121cd9a
https://github.com/WebKit/WebKit/commit/3d0b28687be1fcb0a39e95db941f1742d121cd9a
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2024-06-11 (Tue, 11 Jun 2024)
Changed paths:
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm
Log Message:
-----------
REGRESSION (275396 at main): [iOS] Safari sometimes crashes under -[WKContentView textStylingAtPosition:inDirection:]
https://bugs.webkit.org/show_bug.cgi?id=275339
rdar://127571335
Reviewed by Aditya Keerthi.
After the change in 275396 at main, it's possible for `-textStylingAtPosition:inDirection:` to crash
when attempting to insert a `nil` value into the resulting dictionary. This is because
`+[UIFont fontWithDescriptor:size:]` can apparently return a `nil` `UIFont`, but our code just
assumes that it always returns a non-null value.
Harden against this possibility by null-checking the font before trying to add it to the result, and
also augment a test to exercise this mitigation by forcing `+fontWithDescriptor:size:` to return
`nil` in the middle of the test, and verify that we handle that case gracefully by returning the
original font (without the new symbolic traits).
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView textStylingAtPosition:inDirection:]):
* Tools/TestWebKitAPI/Tests/ios/AutocorrectionTestsIOS.mm:
(returnNil):
(TEST(AutocorrectionTests, FontAtCaretWhenUsingUICTFontTextStyle)):
Canonical link: https://commits.webkit.org/279907@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list