iOS18 WebKit crash when use System Input Method(系统输入法)

When using the system input method to input Chinese, deleting the input character will crash when the last character is deleted.

crash info: reason:NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds

-[WKContentView(WKInteraction) setAttributedMarkedText:selectedRange:]_block_invoke

-[WKContentView(WKInteraction) objc_msgSend$attributesAtIndex:effectiveRange:

(像是WebKit处理系统输入法删除输入信息时,处理文本编辑的问题)

Safari、京东、微信、手百 这些App,网页里使用系统26键中文输入,在删除字符时,都会必现crash

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include sysdiagnose and sample project, and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Same problem, in our app using WKWebView, iOS 18 only

#0 xxxxxx NSRangeException

NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds

0 CoreFoundation ___exceptionPreprocess + 164 1 libobjc.A.dylib _objc_exception_throw + 88 2 Foundation _blockForLocation 3 WebKit ___70-[WKContentView(WKInteraction) setAttributedMarkedText:selectedRange:]_block_invoke + 156 4 WebKit -[WKContentView(WKInteraction) setAttributedMarkedText:selectedRange:] + 136 5 UIKitCore -[UIResponder(UITextInput_Internal) _setAttributedMarkedText:selectedRange:] + 120 6 UIKitCore -[UIKBInputDelegateManager setAttributedMarkedText:selectedRange:] + 152 7 UIKitCore -[_UIKeyboardStateManager _setAttributedMarkedText:selectedRange:inputString:lastInputString:searchString:compareAttributes:] + 696 8 UIKitCore -[_UIKeyboardStateManager setMarkedText:selectedRange:inputString:lastInputString:searchString:candidateOffset:liveConversionSegments:highlighSegmentIndex:] + 692 9 UIKitCore -[_UIKeyboardStateManager assertIntermediateText:] + 200 10 UIKitCore -[_UIKeyboardStateManager syncKeyboardToConfiguration:] + 144 11 UIKitCore ___64-[_UIKeyboardStateManager handleKeyboardInput:executionContext:]_block_invoke_2 + 988 12 UIKitCore -[UIKeyboardTaskEntry execute:] + 208 13 UIKitCore -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 324 14 Foundation ___NSThreadPerformPerform + 264 15 CoreFoundation _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28 16 CoreFoundation ___CFRunLoopDoSource0 + 176 17 CoreFoundation ___CFRunLoopDoSources0 + 244 18 CoreFoundation ___CFRunLoopRun + 840 19 CoreFoundation _CFRunLoopRunSpecific + 572 20 GraphicsServices _GSEventRunModal + 164 21 UIKitCore -[UIApplication _run] + 816 22 UIKitCore _UIApplicationMain + 340 23 XXXX main (main.m:18) 24 dyld 0x00000001aa99d000 + 212276

使用系统的中文输入法,只要是webview的输入框,输入中文,比如输入了一个字母a,这个时候a下面会下划线光标,这个时候删除必定崩溃。只要是删除第一个处于编辑中的字符就可以复现

same problem

iOS18 WebKit crash when use System Input Method(系统输入法)
 
 
Q