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

Extracting 7z sometimes crash #1

Closed
tbaranes opened this issue Jan 20, 2021 · 3 comments
Closed

Extracting 7z sometimes crash #1

tbaranes opened this issue Jan 20, 2021 · 3 comments

Comments

@tbaranes
Copy link

tbaranes commented Jan 20, 2021

Hi,

Thanks for this library! I was using LzmaSDKObjC then migrated to PLzmaSDK since I was looking for SPM support (and because you deprecated the first one).

I'm now encountering a crash on a few 7z extraction, it's a bit random: some passes, others doesn't, but it's always the same stack.

Here a screenshot of the crash and the output using bt in Xcode:

Screenshot 2021-01-20 at 15 00 40

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
  * frame #0: 0x00000001111f4c9c MyFramework`plzma::RawHeapMemory::operator bool<bool>(this=0x0000000000000008) at libplzma.hpp:80:63
    frame #1: 0x00000001111fb8e6 MyFramework`plzma::String::utf8(this=0x0000000000000000) const at plzma_string.cpp:121:14
    frame #2: 0x00000001111f9da5 MyFramework`plzma::Progress::ReportData::report(this=0x00007ffedff23c68) const at plzma_progress.hpp:70:49
    frame #3: 0x00000001111fa15c MyFramework`plzma::Progress::setCompleted(this=0x0000600001ab1a40, completed=86154) at plzma_progress.cpp:151:20
    frame #4: 0x00000001111d901a MyFramework`plzma::BaseCallback::setProgressCompleted(this=0x00007ff694d0c000, completed=86154) at plzma_base_callback.cpp:94:28
    frame #5: 0x00000001111e895c MyFramework`plzma::ExtractCallback::SetCompleted(this=0x00007ff694d0c000, completeValue=0x00007ffedff23da0) at plzma_extract_callback.cpp:66:32
    frame #6: 0x00000001111af4e2 MyFramework`CLocalProgress::SetRatioInfo(this=0x0000600000815090, inSize=0x00007ffedff23e18, outSize=0x00007ff69ac5eae0) at ProgressUtils.cpp:42:23
    frame #7: 0x00000001111bc3ac MyFramework`NCompress::NLzma::CDecoder::CodeSpec(this=0x00007ff69ac5ea70, inStream=0x000060000257cfc0, outStream=0x00006000008163a0, progress=0x0000600000815090) at LzmaDecoder.cpp:207:7
    frame #8: 0x00000001111bc454 MyFramework`NCompress::NLzma::CDecoder::Code(this=0x00007ff69ac5ea70, inStream=0x000060000257cfc0, outStream=0x00006000008163a0, inSize=0x000060000298d330, outSize=0x0000600000834d88, progress=0x0000600000815090) at LzmaDecoder.cpp:219:17
    frame #9: 0x0000000111189891 MyFramework`NCoderMixer2::CMixerST::Code(this=0x0000600001e827c0, inStreams=0x000060000298d380, outStreams=0x00007ffedff24608, progress=0x0000600000815090, dataAfterEnd_Error=0x00007ffedff24a7f) at CoderMixer2.cpp:776:28
    frame #10: 0x0000000111157c1b MyFramework`NArchive::N7z::CDecoder::Decode(this=0x00007ffedff24af0, inStream=0x0000600000562400, startPos=32, folders=0x00007ff694e2c4b8, folderIndex=0, unpackSize=0x00007ffedff24ae0, outStream=0x00006000008163a0, compressProgress=0x0000600000815090, inStreamMainRes=0x0000000000000000, dataAfterEnd_Error=0x00007ffedff24a7f, getTextPassword=0x00007ff694d0c000, isEncrypted=0x00007ffedff24a97, passwordIsDefined=0x00007ffedff24a96, password=0x00007ffedff24a80) at 7zDecode.cpp:557:20
    frame #11: 0x000000011116396f MyFramework`NArchive::N7z::CHandler::Extract(this=0x00007ff694e2c400, indices=0x00007ffedff24d40, numItems=16, testModeSpec=0, extractCallbackSpec=0x00007ff694d0c000) at 7zExtract.cpp:359:32
    frame #12: 0x00000001111ea80a MyFramework`plzma::ExtractCallback::process(this=0x00007ff694d0c000) at plzma_extract_callback.cpp:339:67
    frame #13: 0x00000001111eac52 MyFramework`plzma::ExtractCallback::process(this=0x00007ff694d0c000, mode=0, path=0x0000600002bcb720, itemsFullPath=true) at plzma_extract_callback.cpp:376:9
    frame #14: 0x00000001111da946 MyFramework`bool plzma::DecoderImpl::process<NArchive::NExtract::NAskMode::$_0, plzma::Path const&, bool const&>(this=0x0000600001ab1860, args=0x00007ffedff25278, args=0x0000600002bcb720, args=0x00007ffedff2527f) at plzma_decoder_impl.hpp:87:30
    frame #15: 0x00000001111da762 MyFramework`plzma::DecoderImpl::extract(this=0x0000600001ab1860, path=0x0000600002bcb720, usingItemsFullPath=true) at plzma_decoder_impl.cpp:91:16
    frame #16: 0x00000001111dd1e9 MyFramework`::plzma_decoder_extract_all_items_to_path(decoder=0x00007ffedff253c0, path=0x00007ffedff253b0, items_full_path=true) at plzma_decoder_impl.cpp:268:57
    frame #17: 0x000000011110be7f MyFramework`Decoder.extract(path=0x0000600002bcbc80, itemsFullPath=true, self=0x0000600002b02560) at Decoder.swift:143:22
    frame #18: 0x00000001110de69e MyFramework`KitDownloader.extractArchive(archivePath="/Users/user/Library/Developer/CoreSimulator/Devices/DED1A430-584D-4171-B485-1AD70264556F/data/Containers/Data/Application/2EB1C261-43AA-4A0C-8BA9-3F26B74CDD71/Documents/JamPacks/id/jam.7z", completion=0x00000001110e2020 MyFramework`partial apply forwarder for closure #1 () -> () in KitDownloaderCommon.KitDownloader.(extractJam in _FF877985CBDE0E1D4F887358C8775D0F)(at: Foundation.URL) -> () at <compiler-generated>, self=0x0000600001abe1c0) at KitDownloader.swift:192:25
    frame #19: 0x00000001110dd596 MyFramework`KitDownloader.extractJam(location=<unavailable; try printing with "vo" or "po">, self=0x0000600001abe1c0) at KitDownloader.swift:172:17
    frame #20: 0x00000001110dd30b MyFramework`closure #2 in KitDownloader.downloadArchive(result=<invalid> (0x80), self=0x0000600001abe1c0) at KitDownloader.swift:151:22
    frame #21: 0x000000011110456b MyFramework`closure #1 in DownloadDriver.completeRequest(meta=0x00006000031a2440, result=<invalid> (0x80)) at DownloadDriver.swift:105:18
    frame #22: 0x0000000111103250 MyFramework`thunk for @escaping @callee_guaranteed () -> () at <compiler-generated>:0
    frame #23: 0x0000000115d597ec libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #24: 0x0000000115d5a9c8 libdispatch.dylib`_dispatch_client_callout + 8
    frame #25: 0x0000000115d68e75 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 1152
    frame #26: 0x00007fff2038edbb CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    frame #27: 0x00007fff2038963e CoreFoundation`__CFRunLoopRun + 2685
    frame #28: 0x00007fff203886d6 CoreFoundation`CFRunLoopRunSpecific + 567
    frame #29: 0x00007fff2bededb3 GraphicsServices`GSEventRunModal + 139
    frame #30: 0x00007fff24690e0b UIKitCore`-[UIApplication _run] + 912
    frame #31: 0x00007fff24695cbc UIKitCore`UIApplicationMain + 101
    frame #32: 0x000000010fe00b68 MyApp`main at AppDelegate.swift:7:7
    frame #33: 0x00007fff202593e9 libdyld.dylib`start + 1

and here how we use PLzmaSDK, it's more or less what you put in the README:

        let archivePath = try Path(archivePath)
        let archivePathInStream = try InStream(path: archivePath)
        let decoder = try Decoder(stream: archivePathInStream, fileType: .sevenZ, delegate: self)

        let password = "..."
        try decoder.setPassword(password)
        _ = try decoder.open()

        let outputPath = ...
        _ = try decoder.extract(to: Path(outputPath))

Since the archive has sensible data I can't share it here, but what can I add to help you identify the issue? Did I miss something?

@OlehKulykov
Copy link
Owner

Hi Tom,
first of all I would like to thank you for a such detailed request and I'll take a look on it asap.

@tbaranes
Copy link
Author

Hi, just tried 1.0.3 and it seems the crash is fixed, I tests a few ones that was crashing before but couldn't reproduce the bug. Thanks a lot for your reactivity, and thanks again for your great job on this library!

@AndyLxl
Copy link

AndyLxl commented Feb 6, 2023

There is a problem with the progress of the 7z decompression. The progress only shows 0% - 50% - 100% during the decompression process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants