MacDownApp / macdown

Open source Markdown editor for macOS.
https://macdown.uranusjr.com/
9.44k stars 1.09k forks source link

Crashes on <pre> tag #996

Open nilobarp opened 6 years ago

nilobarp commented 6 years ago

Take this line for instance > Hello world Now try editing it to > Hello <pre>world</pre>

MacDown crashes the moment I type > after <pre

FranklinYu commented 6 years ago
  1. System version
  2. MacDown version
  3. Full example
nilobarp commented 6 years ago
  1. System version: 10.13.5
  2. MacDown version: 0.7.2d126 (996)
  3. Example as stated in initial comment.
FranklinYu commented 6 years ago

Can’t reproduce with same version.

CharlesButcher commented 5 years ago

nilobarp's example seems fine to me, no crash.

maxgarber commented 4 years ago

Encountered this with macOS 10.15.6 (19G2021) running MacDown 0.7.3.

Note: I reproduced the latter after opening MacDown's executable (inside the .app bundle) to get the following stacktrace:

/Applications/MacDown.app/Contents/MacOS$ ./MacDown
2020-09-28 12:16:32.284 MacDown[49458:37419894] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff30d2bb57 __exceptionPreprocess + 250
    1   libobjc.A.dylib                     0x00007fff69bd85bf objc_exception_throw + 48
    2   Foundation                          0x00007fff333447a8 -[NSRegularExpression numberOfCaptureGroups] + 0
    3   Foundation                          0x00007fff33397173 -[NSRegularExpression(NSMatching) matchesInString:options:range:] + 146
    4   Foundation                          0x00007fff333a708b -[NSRegularExpression(NSReplacement) stringByReplacingMatchesInString:options:range:withTemplate:] + 176
    5   MacDown                             0x000000010242158f MacDown + 83343
    6   MacDown                             0x0000000102420d73 MacDown + 81267
    7   Foundation                          0x00007fff3332aac5 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
    8   Foundation                          0x00007fff3332a9e6 -[NSBlockOperation main] + 80
    9   Foundation                          0x00007fff3332a981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
    10  Foundation                          0x00007fff33329bb3 -[NSOperation start] + 722
    11  Foundation                          0x00007fff333298d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
    12  Foundation                          0x00007fff333297a9 __NSOQSchedule_f + 182
    13  libdispatch.dylib                   0x00007fff6ad332b9 _dispatch_block_async_invoke2 + 83
    14  libdispatch.dylib                   0x00007fff6ad27658 _dispatch_client_callout + 8
    15  libdispatch.dylib                   0x00007fff6ad29818 _dispatch_continuation_pop + 414
    16  libdispatch.dylib                   0x00007fff6ad28f16 _dispatch_async_redirect_invoke + 703
    17  libdispatch.dylib                   0x00007fff6ad35957 _dispatch_root_queue_drain + 326
    18  libdispatch.dylib                   0x00007fff6ad36097 _dispatch_worker_thread2 + 92
    19  libsystem_pthread.dylib             0x00007fff6af819f7 _pthread_wqthread + 220
    20  libsystem_pthread.dylib             0x00007fff6af80b77 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

So it seems there's a problem in the use of the NSRegularExpression API.