Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global search: some Chinese character cause CRASH #958

Open
laoyuan opened this issue May 10, 2021 · 7 comments
Open

Global search: some Chinese character cause CRASH #958

laoyuan opened this issue May 10, 2021 · 7 comments
Labels
bug Something isn't working. crash Bad stuff — something related to an app crash! [feature] search Anything related to searching.

Comments

@laoyuan
Copy link

laoyuan commented May 10, 2021

I'm a heavy user from China. There're hundreds of notes by Chinese in my account. When I search for "的", which means "of", the most frequent word, Simplenote exits every time. Another account has only tens of notes, doing same thing dosn't exit.

Edition: 2.11
OS: 11.0.1 and 10.15.4

@jleandroperez
Copy link
Contributor

Hello @laoyuan, thank you for reaching out!!

Would it be possible to get a snippet of any of the notes that cause the crash?

@laoyuan
Copy link
Author

laoyuan commented May 11, 2021

@jleandroperez
刘慈欣《三体》美版后记译文

童年的某个夜晚清晰地印在我的记忆里挥之不去:我站在河南省罗山县某村庄的池塘边,那是我的祖辈曾生活过的地方,我身边还站着许多人,有大人也有孩子。我们一起仰望着晴朗的夜空,一颗小星星缓缓划过黯淡的天际。

这是中国发射的第一颗人造卫星:东方红一号。那天是1970年4月25日,我七岁。

从“斯普特尼克号”(人类第一颗人造卫星)发射到太空已过13年,距离第一位宇航员飞出地球也已历时9年。而就在一周前,“阿波罗13号”从险象环生的登月行动中安全返航。

但这些我都不知道。当我凝视着那颗小小的、滑翔的星星时,我的心中充满了难以形容的好奇和向往。

而让我感同身受且记忆深刻的,是腹中的饥饿。那时,这片地区非常贫穷。饥饿伴随着每一个孩子。我比较幸运,因为我的脚上还有鞋子。站在我身边的小伙伴,大部分都是光着脚的,有些小脚丫还长着前一年冬天的冻疮,没能痊愈。在我身后,微弱的煤油灯从破茅草屋墙上的缝隙中透出昏黄的光线——这个村子直到20世纪80年代才通电。

站在旁边的大人说,这颗卫星可不像飞机,它是飞离地球之外的。那时的大气层还没有被工业粉尘和废气污染,繁星璀璨,银河系清晰可见。在我看来,满天星星的距离并不比那颗滑翔的小卫星远多少,所以我想它正飞向群星之间。我甚至担心,它在经过密集的恒星团时会撞上其中一颗。

@laoyuan
Copy link
Author

laoyuan commented May 11, 2021

Process: Simplenote [413]
Path: /Applications/Simplenote.app/Contents/MacOS/Simplenote
Identifier: Simplenote
Version: 2.11 (11231)
App Item ID: 692867256
App External ID: 841457149
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Simplenote [413]
User ID: 501

Date/Time: 2021-05-11 09:36:55.792 +0800
OS Version: Mac OS X 10.15.4 (19E287)
Report Version: 12
Anonymous UUID: F51E0268-B39D-4170-3A60-A94355CDF0EE

Time Awake Since Boot: 250 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [413]

Application Specific Information:
Fatal error: String index is out of bounds: file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.8.25.8/swift/stdlib/public/core/StringCharacterView.swift, line 60

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libswiftCore.dylib 0x00007fff66afd1e1 closure #1 in closure #1 in closure #1 in assertionFailure(::file:line🎏) + 529
1 libswiftCore.dylib 0x00007fff66afccf7 closure #1 in closure #1 in assertionFailure(:
:file:line🎏) + 87
2 libswiftCore.dylib 0x00007fff66afc9c3 closure #1 in assertionFailure(::file:line🎏) + 99
3 libswiftCore.dylib 0x00007fff66afc5d5 assertionFailure(:
:file:line🎏) + 533
4 libswiftCore.dylib 0x00007fff66b0b8ea String.index(after:) + 298
5 com.automattic.SimplenoteMac 0x000000010588cf49 0x105852000 + 241481
6 com.automattic.SimplenoteMac 0x000000010588d390 0x105852000 + 242576
7 libswiftFoundation.dylib 0x00007fff6705b811 partial apply for closure #1 in StringProtocol.enumerateSubstrings(in:options:_:) + 193
8 libswiftFoundation.dylib 0x00007fff66fde3a5 thunk for @escaping @callee_guaranteed (@guaranteed String?, @unowned _NSRange, @unowned NSRange, @unowned UnsafeMutablePointer) -> () + 133
9 com.apple.Foundation 0x00007fff2fc769a4 -[NSString enumerateSubstringsInRange:options:usingBlock:] + 2007
10 libswiftFoundation.dylib 0x00007fff66fde2f2 StringProtocol.enumerateSubstrings
(in:options::) + 386
11 com.automattic.SimplenoteMac 0x000000010588cb0c 0x105852000 + 240396
12 com.automattic.SimplenoteMac 0x000000010589af20 0x105852000 + 298784
13 com.automattic.SimplenoteMac 0x000000010587b4f1 0x105852000 + 169201
14 com.automattic.SimplenoteMac 0x000000010587b6d5 0x105852000 + 169685
15 com.apple.AppKit 0x00007fff2a988ae2 -[NSTableView(NSTableViewViewBased) _delegate_viewForTableColumn:row:] + 88
16 com.apple.AppKit 0x00007fff2a89a849 -[NSTableView(NSTableViewViewBased) makeViewForTableColumn:row:] + 87
17 com.apple.AppKit 0x00007fff2a899dc8 -[NSTableRowData _addViewToRowView:atColumn:row:] + 327
18 com.apple.AppKit 0x00007fff2a899b01 -[NSTableRowData _addViewsToRowView:atRow:] + 191
19 com.apple.AppKit 0x00007fff2a897b51 -[NSTableRowData _initializeRowView:atRow:] + 406
20 com.apple.AppKit 0x00007fff2a895e5a -[NSTableRowData _preparedRowViewForRow:storageHandler:] + 140
21 com.apple.AppKit 0x00007fff2a895cce -[NSTableRowData _addRowViewForVisibleRow:withPriorView:] + 376
22 com.apple.AppKit 0x00007fff2a895ab5 -[NSTableRowData _addRowViewForVisibleRow:withPriorRowIndex:inDictionary:withRowAnimation:] + 361
23 com.apple.AppKit 0x00007fff2a894922 -[NSTableRowData _updateVisibleRowEntries] + 1149
24 com.apple.AppKit 0x00007fff2a894275 -[NSTableRowData updateVisibleRowViews] + 372
25 com.apple.AppKit 0x00007fff2a9d749c -[NSTableRowData prepareContentInRect:] + 89
26 com.apple.AppKit 0x00007fff2a9d7434 -[NSTableView prepareContentInRect:] + 262
27 com.apple.AppKit 0x00007fff2a9d718f __38-[NSView _pullInExtraTilesForOverdraw]_block_invoke + 325
28 com.apple.AppKit 0x00007fff2a9d6a7b -[NSView _performWorkOnTilesFromRect:renderedContentRect:maximumRect:scrollVelocity:handler:] + 1812
29 com.apple.AppKit 0x00007fff2a9d6210 -[NSView _pullInExtraTilesForOverdraw] + 844
30 com.apple.AppKit 0x00007fff2a9d5e93 -[NSView _doIdlePrefetch] + 37
31 com.apple.AppKit 0x00007fff2a9d5c5a idle_perform + 28
32 com.apple.CoreFoundation 0x00007fff2d559f12 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
33 com.apple.CoreFoundation 0x00007fff2d559eb1 __CFRunLoopDoSource0 + 103
34 com.apple.CoreFoundation 0x00007fff2d559ccb __CFRunLoopDoSources0 + 209
35 com.apple.CoreFoundation 0x00007fff2d5589fa __CFRunLoopRun + 927
36 com.apple.CoreFoundation 0x00007fff2d557ffe CFRunLoopRunSpecific + 462
37 com.apple.HIToolbox 0x00007fff2c18babd RunCurrentEventLoopInMode + 292
38 com.apple.HIToolbox 0x00007fff2c18b7d5 ReceiveNextEventCommon + 584
39 com.apple.HIToolbox 0x00007fff2c18b579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
40 com.apple.AppKit 0x00007fff2a7d6c99 _DPSNextEvent + 883
41 com.apple.AppKit 0x00007fff2a7d54e0 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
42 com.apple.AppKit 0x00007fff2a7c71ee -[NSApplication run] + 658
43 com.apple.AppKit 0x00007fff2a798ff6 NSApplicationMain + 777
44 libdyld.dylib 0x00007fff674a0cc9 start + 1
......

@pachlava pachlava added crash Bad stuff — something related to an app crash! bug Something isn't working. [feature] search Anything related to searching. labels May 11, 2021
@eshurakov
Copy link
Contributor

We've previously fixed a crash happening during excerpts generation (Automattic/simplenote-ios#1064).

I think the root cause is the same here, the crash happens when we try to calculate distance between two indexes of string (https://github.com/Automattic/simplenote-macos/blob/develop/Simplenote/String%2BSimplenote.swift#L152).

Possible solutions may be to replace distance with something else or use CFStringTokenizer instead of enumerateSubstrings.

@laoyuan
Copy link
Author

laoyuan commented Jun 20, 2021

Still crash on 2.13

@charliescheer
Copy link
Contributor

I have been looking into a similar crash on iOS Automattic/simplenote-ios#1403 I think these may be the same issue with how enumerateSubstrings work

@csonnek
Copy link
Member

csonnek commented Nov 15, 2022

Another report via Twitter (thread starts here): https://twitter.com/Apple71171/status/1592036057042014208

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. crash Bad stuff — something related to an app crash! [feature] search Anything related to searching.
Projects
None yet
Development

No branches or pull requests

6 participants