scr34m / MailReceipt

Mail Receipt is a Mac OS X application which is adds two button to composing window for delivery notification and read receipt requests.
29 stars 2 forks source link

MailReceipt crashes Mail.App on MacOs Catalina 15.7 #15

Closed oskarfessel closed 2 years ago

oskarfessel commented 2 years ago

When composing a mail (new or reply, does not matter) changing the account to send from crashes Mail.app, mostly on first change, sometimes it lasts until the second account change. This happens with GPGMail enabled as well with that disabled. It happens before any other action is taken, like typing text or even selecting D or R. Mail handles about 200 Accounts from 10 Mailboxes, if that does help.

Any information that I can provide to help with that?

--- obviously, MailReceipt crashes when there is no "<" in the account...

`Process: Mail [98597] Path: /System/Applications/Mail.app/Contents/MacOS/Mail Identifier: com.apple.mail Version: 13.4 (3608.120.23.2.7) Build Info: Mail-3608120023002007~1 Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: Mail [98597] User ID: 501

Date/Time: 2022-06-06 16:13:29.129 +0200 OS Version: Mac OS X 10.15.7 (19H1922) Report Version: 12 Bridge OS Version: 6.5 (19P5071) Anonymous UUID: 4AD4EBE5-4068-3834-CE74-BC8797D5E1FC

Sleep/Wake UUID: FE30A333-C163-4FDB-A797-20C520765B25

Time Awake Since Boot: 560000 seconds Time Since Wake: 73000 seconds

System Integrity Protection: enabled

Crashed Thread: 13 Dispatch queue: NSOperationQueue 0x7ffb7aff6e50 (QOS: UNSPECIFIED)

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information: dyld3 mode Terminating app due to uncaught exception 'NSRangeException', reason: ' -[__NSCFString substringFromIndex:]: Index 9223372036854775808 out of bounds; string length 22' terminating with uncaught exception of type NSException abort() called

Application Specific Backtrace 1: 0 CoreFoundation 0x00007fff3543add7 exceptionPreprocess + 250 1 libobjc.A.dylib 0x00007fff6de955bf objc_exception_throw + 48 2 Foundation 0x00007fff37a275e7 -[NSBundle preferredLocalizations] + 0 3 MailReceipt 0x0000000105ee7bb8 +[MailReceiptPlugin extractEmailAddress:] + 78 4 MailReceipt 0x0000000105ee4eef -[ComposeBackEnd_MailReceiptPlugin MPP_newOutgoingMessageUsingWriter:contents:headers:isDraft:] + 126 5 Mail 0x000000010195db03 Mail + 846595 6 GPGMail 0x0000000105fd9241 -[ComposeBackEnd_GPGMail MA_makeMessageWithContents:isDraft:shouldSign:shouldEncrypt:shouldSkipSignature:] + 1905 7 Mail 0x0000000101969d85 Mail + 896389 8 Mail 0x00000001019699d6 Mail + 895446 9 Foundation 0x00007fff37a3c3d5 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7 10 Foundation 0x00007fff37a3c2f6 -[NSBlockOperation main] + 80 11 Foundation 0x00007fff37a3c291 NSOPERATION_IS_INVOKING_MAIN + 17 12 Foundation 0x00007fff37a3b4c3 -[NSOperation start] + 722 13 Foundation 0x00007fff37a3b1e9 NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 17 14 Foundation 0x00007fff37a3b0b9 NSOQSchedule_f + 182 15 libdispatch.dylib 0x00007fff6eff02b9 _dispatch_block_async_invoke2 + 83 16 libdispatch.dylib 0x00007fff6efe4658 _dispatch_client_callout + 8 17 libdispatch.dylib 0x00007fff6efe6818 _dispatch_continuation_pop + 414 18 libdispatch.dylib 0x00007fff6efe5f16 _dispatch_async_redirect_invoke + 703 19 libdispatch.dylib 0x00007fff6eff2957 _dispatch_root_queue_drain + 326 20 libdispatch.dylib 0x00007fff6eff3097 _dispatch_worker_thread2 + 92 21 libsystem_pthread.dylib 0x00007fff6f23e9f7 _pthread_wqthread + 220 22 libsystem_pthread.dylib 0x00007fff6f23db77 start_wqthread + 15 ... Thread 13 Crashed:: Dispatch queue: NSOperationQueue 0x7ffb7aff6e50 (QOS: UNSPECIFIED) 0 libsystem_kernel.dylib 0x00007fff6f18532a __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff6f241e60 pthread_kill + 430 2 libsystem_c.dylib 0x00007fff6f10c808 abort + 120 3 libc++abi.dylib 0x00007fff6c369458 abort_message + 231 4 libc++abi.dylib 0x00007fff6c35a8bf demangling_terminate_handler() + 262 5 libobjc.A.dylib 0x00007fff6de975a9 _objc_terminate() + 96 6 libc++abi.dylib 0x00007fff6c368887 std::__terminate(void (*)()) + 8 7 libc++abi.dylib 0x00007fff6c368829 std::terminate() + 41 8 libdispatch.dylib 0x00007fff6efe466c _dispatch_client_callout + 28 9 libdispatch.dylib 0x00007fff6efe6818 _dispatch_continuation_pop + 414 10 libdispatch.dylib 0x00007fff6efe5f16 _dispatch_async_redirect_invoke + 703 11 libdispatch.dylib 0x00007fff6eff2957 _dispatch_root_queue_drain + 326 12 libdispatch.dylib 0x00007fff6eff3097 _dispatch_worker_thread2 + 92 13 libsystem_pthread.dylib 0x00007fff6f23e9f7 _pthread_wqthread + 220 14 libsystem_pthread.dylib 0x00007fff6f23db77 start_wqthread + 15

Thread 14: 0 libsystem_pthread.dylib 0x00007fff6f23db68 start_wqthread + 0

Thread 13 crashed with X86 Thread State (64-bit): rax: 0x0000000000000000 rbx: 0x0000700001ff5000 rcx: 0x0000700001ff4808 rdx: 0x0000000000000000 rdi: 0x000000000003c52b rsi: 0x0000000000000006 rbp: 0x0000700001ff4830 rsp: 0x0000700001ff4808 r8: 0x0000700001ff46d0 r9: 0x0000700001ff48a0 r10: 0x0000700001ff5000 r11: 0x0000000000000246 r12: 0x000000000003c52b r13: 0x0000003000000008 r14: 0x0000000000000006 r15: 0x0000000000000016 rip: 0x00007fff6f18532a rfl: 0x0000000000000246 cr2: 0x0000700001f6e050

Logical CPU: 0 Error Code: 0x02000148 Trap Number: 133

...

Model: MacBookPro16,1, BootROM 1731.120.10.0.0 (iBridge: 19.16.15071.0.0,0), 8 processors, 8-Core Intel Core i9, 2,3 GHz, 32 GB, SMC Graphics: kHW_IntelUHDGraphics630Item, Intel UHD Graphics 630, spdisplays_builtin Graphics: kHW_AMDRadeonPro5500MItem, AMD Radeon Pro 5500M, spdisplays_pcie_device, 8 GB Memory Module: BANK 0/ChannelA-DIMM0, 16 GB, DDR4, 2667 MHz, SK Hynix, - Memory Module: BANK 2/ChannelB-DIMM0, 16 GB, DDR4, 2667 MHz, SK Hynix, - AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x7BF), wl0: Oct 28 2020 14:13:29 version 9.30.357.42.32.5.48 FWID 01-767f6cce Bluetooth: Version 7.0.6f8, 3 services, 27 devices, 1 incoming serial ports Network Service: Belkin USB-C LAN, Ethernet, en8 Network Service: Wi-Fi, AirPort, en0 USB Device: USB 3.1 Bus USB Device: Apple T2 Bus USB Device: Composite Device USB Device: Touch Bar Backlight USB Device: Touch Bar Display USB Device: Apple Internal Keyboard / Trackpad USB Device: Headset USB Device: Ambient Light Sensor USB Device: FaceTime HD Camera (Built-in) USB Device: Apple T2 Controller Thunderbolt Bus: MacBook Pro, Apple Inc., 55.3 Thunderbolt Bus: MacBook Pro, Apple Inc., 55.3

`

scr34m commented 2 years ago

From the stacktrace the cause is visible, will check and possibly easy to fix.

oskarfessel commented 2 years ago

Just a kludge, but works for me - but it surely does not cover all cases. In MailReceiptPlugin.m:

+ (NSString *) extractEmailAddress: (NSString *)address
{
    NSRange r = [address rangeOfString:@"<" options:NSBackwardsSearch];
    if (r.location != NSNotFound) {
        NSString *senderEmail = [address substringFromIndex:r.location + 1];
        r = [senderEmail rangeOfString:@">" options:NSBackwardsSearch];
        return [senderEmail substringToIndex:r.location];
    } else {
        return address;
    }
}
scr34m commented 2 years ago

Yes this is the problematic part, didn't checked the less sign, thanks for the patch new version available.