We built the 'EncryptingAndDecryptingDirectories' Swift sample project as a MacOS app with Xcode 15.4, then ran the sample app on MacOS Sonoma 14.4.1. In this test run we dragged a 56 MB corrupt archive (which was supposed to contain 788 MB of data) into the app's window, then entered its decryption key. Here's a DEBUG log when decrypting the corrupt archive file: BOOL _NSPersistentUIDeleteItemAtFileURL(NSURL *const __strong) Failed to stat item: file:///Users/dev987/Library/Containers/com.example.apple-samplecode.DirectoryEncryptionDecryption/Data/Library/Saved%20Application%20State/com.example.apple-samplecode.DirectoryEncryptionDecryption.savedState/restorecount.plist FAULT: determined it was necessary to configure to support remote view vibrancy [0x9e031800] reading segment data [0x9e042800] loading segment [0x9e01f400] decrypting segment [0x9e04a800] decrypting segment 0 [0xd7014800] worker proc reported an error [0x9e050400] SharedBufferWrite [0xbd008c00] istream read error [0xd7023400] consumer proc reported an error [0xd7023400] consumer proc reported an error [0x9e031800] reading segment data [0xbd014800] refill buffer failed [0xd7023400] consumer proc reported an error [0x9e042800] loading segment [0xbd052400] read error [0xd7014800] worker proc reported an error [0xd7014800] worker proc reported an error [0x90012c00] archive stream read error (blob) [0xd7023400] consumer proc reported an error [0xd7023400] consumer proc reported an error [0xd7023400] consumer proc reported an error [0xd7023400] consumer proc reported an error [0xd7023400] consumer proc reported an error [0xd7023400] consumer proc reported an error [0xd7023400] consumer proc reported an error [0xd7047400] Threads reported errors [0x9e06d800] Stream processing cancelled [0xc8173800] stream cancelled [0xc8185000] 1 entries failed to extract Here's the associated CRASH log: Thread 1: EXC_BAD_ACCESS (code=1, address=0x77) Thread 1 Queue : com.apple.main-thread (serial) #0 0x0000000000000077 in 0x00000077 () #1 0x00007ffc2f51df42 in AAArchiveStreamClose () #2 0x00007ffc30b670dc in ArchiveStream.__deallocating_deinit () #3 0x00007ff828775230 in _swift_release_dealloc () #4 0x00007ff828775bdb in bool swift::RefCounts>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) () #5 0x000000010a564945 in static ArchiverEncryptor.decrypt(sourceURL:encryptionKey:) at /Users/dev987/Documents/SwiftApps/EncryptingAndDecryptingDirectoriesMyMacTest/DirectoryEncryptionDecryption/ArchiverEncryptor.swift:264 #6 0x000000010a554fb8 in ContentView.submitBase64EncodedKeyData() at /Users/dev987/Documents/SwiftApps/EncryptingAndDecryptingDirectoriesMyMacTest/DirectoryEncryptionDecryption/ContentView.swift:142 #7 0x000000010a5588eb in closure #1 in closure #1 in closure #1 in ContentView.body.getter at /Users/dev987/Documents/SwiftApps/EncryptingAndDecryptingDirectoriesMyMacTest/DirectoryEncryptionDecryption/ContentView.swift:180 #8 0x00007ff925238f48 in ___lldb_unnamed_symbol112397 () #9 0x00007ff925dbe87d in ___lldb_unnamed_symbol195471 () #10 0x00007ff925dbe963 in ___lldb_unnamed_symbol195472 () #11 0x00007ff81b7062b6 in -[NSApplication(NSResponder) sendAction:to:from:] () #12 0x00007ff81b70612b in -[NSControl sendAction:to:] () #13 0x00007ff81b7bbe8e in -[NSTextField textDidEndEditing:] () #14 0x00007ff817ea9130 in __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ () #15 0x00007ff817f39b56 in ___CFXRegistrationPost_block_invoke () #16 0x00007ff817f39aa0 in _CFXRegistrationPost () #17 0x00007ff817e7904b in _CFXNotificationPost () #18 0x00007ff818e0fd3e in -[NSNotificationCenter postNotificationName:object:userInfo:] () #19 0x00007ff81b86e3b9 in -[NSTextView(NSPrivate) _giveUpFirstResponder:] () #20 0x00007ff81b7d9f94 in -[NSTextView doCommandBySelector:] () #21 0x00007ff81b7d9e49 in -[NSTextInputContext(NSInputContext_WithCompletion) doCommandBySelector:completionHandler:] () #22 0x00007ff81b70d6ef in -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] () #23 0x00007ff81b71625e in __84-[NSTextInputContext _handleEvent:options:allowingSyntheticEvent:completionHandler:]_block_invoke_5 () #24 0x00007ff81c2aebd9 in __84-[NSTextInputContext _handleEvent:options:allowingSyntheticEvent:completionHandler:]_block_invoke_3.922 () #25 0x00007ff81b71604e in -[NSTextInputContext tryHandleEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] () #26 0x00007ff81c2aeb60 in __84-[NSTextInputContext _handleEvent:options:allowingSyntheticEvent:completionHandler:]_block_invoke.919 () #27 0x00007ff822a52232 in __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_6 () #28 0x00007ff82290a46d in invocation function for block in DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) () #29 0x00007ff81c2a9d90 in __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke.321 () #30 0x00007ff81b70f3b8 in __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2 () #31 0x00007ff81b70f33f in -[NSTextInputContext tryHandleTSMEvent_HasMarkedText_withDispatchCondition:dispatchWork:continuation:] () #32 0x00007ff81b70e9c6 in -[NSTextInputContext handleTSMEvent:completionHandler:] () #33 0x00007ff81b70e21d in _NSTSMEventHandler () #34 0x00007ff82289d573 in DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) () #35 0x00007ff82289c9bf in SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) () #36 0x00007ff82289c85e in SendEventToEventTargetWithOptions () #37 0x00007ff8228f5bb1 in SendTSMEvent_WithCompletionHandler () #38 0x00007ff8228f6065 in __SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler_block_invoke () #39 0x00007ff8228f5eba in __SendFilterTextEvent_WithCompletionHandler_block_invoke () #40 0x00007ff8228f5c01 in SendTSMEvent_WithCompletionHandler () #41 0x00007ff8228f5a00 in SendFilterTextEvent_WithCompletionHandler () #42 0x00007ff8228f56c1 in SendUnicodeTextAEToUnicodeDoc_WithCompletionHandler () #43 0x00007ff8228f5473 in __utDeliverTSMEvent_WithCompletionHandler_block_invoke_2 () #44 0x00007ff8228f52d6 in __utDeliverTSMEvent_WithCompletionHandler_block_invoke () #45 0x00007ff8228f5125 in TSMKeyEvent_WithCompletionHandler () #46 0x00007ff8228f97e0 in __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_5 () #47 0x00007ff8228f4ecc in __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_4 () #48 0x00007ff8228f4d03 in __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_3 () #49 0x00007ff8228f4aba in __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke_2 () #50 0x00007ff8228f485c in __TSMProcessRawKeyEventWithOptionsAndCompletionHandler_block_invoke () #51 0x00007ff8228e35fb in TSMProcessRawKeyEventWithOptionsAndCompletionHandler () #52 0x00007ff81c2aea57 in __84-[NSTextInputContext _handleEvent:options:allowingSyntheticEvent:completionHandler:]_block_invoke_3.917 () #53 0x00007ff81c2ae7b6 in __204-[NSTextInputContext tryTSMProcessRawKeyEvent_orSubstitution:dispatchCondition:setupForDispatch:furtherCondition:doubleSpaceSubstitutionCondition:doubleSpaceSubstitutionWork:dispatchTSMWork:continuation:]_block_invoke.881 () #54 0x00007ff81b70cd52 in -[NSTextInputContext tryTSMProcessRawKeyEvent_orSubstitution:dispatchCondition:setupForDispatch:furtherCondition:doubleSpaceSubstitutionCondition:doubleSpaceSubstitutionWork:dispatchTSMWork:continuation:] () #55 0x00007ff81b70c750 in -[NSTextInputContext _handleEvent:options:allowingSyntheticEvent:completionHandler:] () #56 0x00007ff81b70c1a2 in -[NSTextInputContext _handleEvent:allowingSyntheticEvent:] () #57 0x00007ff81b70c018 in -[NSView interpretKeyEvents:] () #58 0x00007ff81b70be65 in -[NSTextView keyDown:] () #59 0x00007ff925524291 in ___lldb_unnamed_symbol133719 () #60 0x00007ff925524433 in ___lldb_unnamed_symbol133721 () #61 0x00007ff81b679142 in -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] () #62 0x00007ff81b678d1f in -[NSWindow(NSEventRouting) sendEvent:] () #63 0x00007ff81be282b6 in -[NSApplication(NSEventRouting) sendEvent:] () #64 0x00007ff81b9e35c2 in -[NSApplication _handleEvent:] () #65 0x00007ff81b50b02a in -[NSApplication run] () #66 0x00007ff81b4deff1 in NSApplicationMain () #67 0x00007ff92496ff47 in ___lldb_unnamed_symbol56704 () #68 0x00007ff925067ad4 in ___lldb_unnamed_symbol103975 () #69 0x00007ff92542cf9f in static App.main() () #70 0x000000010a5662ae in static DirectoryEncryptionDecryptionApp.$main() () #71 0x000000010a566349 in main at /Users/dev987/Documents/SwiftApps/EncryptingAndDecryptingDirectoriesMyMacTest/DirectoryEncryptionDecryption/DirectoryEncryptionDecryptionApp.swift:11 #72 0x00007ff817a4b366 in start ()