Lately, we are getting a few crash reports ending up with:
NSRangeException
*** -[NSConcreteTextStorage attribute:atIndex:longestEffectiveRange:inRange:]: Range or index out of bounds
The full stack trace is:
Thread 0 Crashed:
0 CoreFoundation 0xfff0177080a6 __exceptionPreprocess
1 libobjc.A.dylib 0xfff016dcd231 objc_exception_throw
2 UIFoundation 0xfff020adce02 -[NSConcreteTextStorage attribute:atIndex:longestEffectiveRange:inRange:]
3 AppKit 0xfff01f051947 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_7.611
4 AppKit 0xfff01f05178e __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2.605
5 AppKit 0xfff01f04d137 -[NSTextInputContext tryHandleTSMEvent_attributedString_attributedSubstringForProposedRange_withContext:dispatchCondition:dispatchWork:dispatchFurtherCondition:dispatchFurtherWork:continuation:]
6 AppKit 0xfff01e4d37c7 -[NSTextInputContext handleTSMEvent:completionHandler:]
7 AppKit 0xfff01e4d29c8 _NSTSMEventHandler
8 HIToolbox 0xfff02c78f702 DispatchEventToHandlers
9 HIToolbox 0xfff02c78eb4e SendEventToEventTargetInternal
10 HIToolbox 0xfff02c78e9ed SendEventToEventTargetWithOptions
11 HIToolbox 0xfff02c7e7da0 SendTSMEvent_WithCompletionHandler
12 HIToolbox 0xfff02c9404bf __SendTextInputEvent_WithCompletionHandler_block_invoke
13 HIToolbox 0xfff02c93ee07 SendTextInputEvent_WithCompletionHandler
14 HIToolbox 0xfff02c9a06b4 -[IMKInputSession _postEvent:completionHandler:]
15 HIToolbox 0xfff02c9b3997 -[IMKInputSession do_coreAttributesFromRange_postEventLoopWithContext:initBlockEach:postEventCompletionEach:whileConditionBlock:finalCompletion:]
16 HIToolbox 0xfff02c9b4710 __78-[IMKInputSession _coreAttributesFromRange:whichAttributes:completionHandler:]_block_invoke_10
17 HIToolbox 0xfff02c7fc58c DispatchEventToHandlers
18 AppKit 0xfff01f051707 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_7.599
19 AppKit 0xfff01f051412 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2.593
20 AppKit 0xfff01f04d137 -[NSTextInputContext tryHandleTSMEvent_attributedString_attributedSubstringForProposedRange_withContext:dispatchCondition:dispatchWork:dispatchFurtherCondition:dispatchFurtherWork:continuation:]
21 AppKit 0xfff01e4d37c7 -[NSTextInputContext handleTSMEvent:completionHandler:]
22 AppKit 0xfff01e4d29c8 _NSTSMEventHandler
23 HIToolbox 0xfff02c78f702 DispatchEventToHandlers
24 HIToolbox 0xfff02c78eb4e SendEventToEventTargetInternal
25 HIToolbox 0xfff02c78e9ed SendEventToEventTargetWithOptions
26 HIToolbox 0xfff02c7e7da0 SendTSMEvent_WithCompletionHandler
27 HIToolbox 0xfff02c9404bf __SendTextInputEvent_WithCompletionHandler_block_invoke
28 HIToolbox 0xfff02c93ee07 SendTextInputEvent_WithCompletionHandler
29 HIToolbox 0xfff02c9a06b4 -[IMKInputSession _postEvent:completionHandler:]
30 HIToolbox 0xfff02c9b3997 -[IMKInputSession do_coreAttributesFromRange_postEventLoopWithContext:initBlockEach:postEventCompletionEach:whileConditionBlock:finalCompletion:]
31 HIToolbox 0xfff02c9b39fe __145-[IMKInputSession do_coreAttributesFromRange_postEventLoopWithContext:initBlockEach:postEventCompletionEach:whileConditionBlock:finalCompletion:]_block_invoke
32 HIToolbox 0xfff02c7fc58c DispatchEventToHandlers
33 AppKit 0xfff01f051707 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_7.599
34 AppKit 0xfff01f051412 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2.593
35 AppKit 0xfff01f04d137 -[NSTextInputContext tryHandleTSMEvent_attributedString_attributedSubstringForProposedRange_withContext:dispatchCondition:dispatchWork:dispatchFurtherCondition:dispatchFurtherWork:continuation:]
36 AppKit 0xfff01e4d37c7 -[NSTextInputContext handleTSMEvent:completionHandler:]
37 AppKit 0xfff01e4d29c8 _NSTSMEventHandler
38 HIToolbox 0xfff02c78f702 DispatchEventToHandlers
39 HIToolbox 0xfff02c78eb4e SendEventToEventTargetInternal
40 HIToolbox 0xfff02c78e9ed SendEventToEventTargetWithOptions
41 HIToolbox 0xfff02c7e7da0 SendTSMEvent_WithCompletionHandler
42 HIToolbox 0xfff02c9404bf __SendTextInputEvent_WithCompletionHandler_block_invoke
43 HIToolbox 0xfff02c93ee07 SendTextInputEvent_WithCompletionHandler
44 HIToolbox 0xfff02c9a06b4 -[IMKInputSession _postEvent:completionHandler:]
45 HIToolbox 0xfff02c9b3997 -[IMKInputSession do_coreAttributesFromRange_postEventLoopWithContext:initBlockEach:postEventCompletionEach:whileConditionBlock:finalCompletion:]
It mostly affects our macOS 14 users who are from China, Hong Kong, and Taiwan - using weird locales most probably.
Is anyone having similar problems?