Skip to content

[Bug]: Compresses zip files throw "Error while compressing files: 未指定错误 _DoFree=true" #281

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

Open
1 task done
Zyj0707 opened this issue Mar 18, 2025 · 4 comments
Assignees
Labels

Comments

@Zyj0707
Copy link

Zyj0707 commented Mar 18, 2025

bit7z version

4.0.x

Compilation options

No response

7-zip version

v23.01

7-zip shared library used

7z.dll / 7z.so

Compilers

MSVC

Compiler versions

No response

Architecture

x86_64

Operating system

Windows

Operating system versions

Windows 10

Bug description

When I try to compress a file called "xxx.zip", compressFile throws an exception: "Error while compressing files: Unspecified error _DoFree=true". There will be problems with nested compression. The compressed file is about 1G.

Steps to reproduce

No response

Expected behavior

No response

Relevant compilation output

Code of Conduct

@Zyj0707
Copy link
Author

Zyj0707 commented Mar 18, 2025

Image

@rikyoz
Copy link
Owner

rikyoz commented Mar 18, 2025

Hi!
Could you provide the code you're using for the compression?
What kind of files are you trying to compress?
Thank you!

@Zyj0707
Copy link
Author

Zyj0707 commented Mar 19, 2025

try { // bit7z classes can throw BitException objects
using namespace bit7z;

   Bit7zLibrary lib{ "7z.dll" };
   BitFileCompressor compressor{ lib, BitFormat::Zip };
   compressor.compressFile("C:\\test.zip", "test2.zip");

}
catch (const bit7z::BitException& ex) { 
   std::cout << "error:" << std::endl;
}

If the file size is larger than 2G, an error will occur. The same is true when using minizip. After investigation, it was found that the problem with minizip is that it uses 32-bit file streams. After removing the USE_FILE32API macro, minizip can compress normally. See if this helps you.

@rikyoz
Copy link
Owner

rikyoz commented Mar 19, 2025

Thanks for the details.

Strange, I've tried to replicate the issue, but I didn't have success so far.
I tested the compression of a ~5GB zip file to a second zip file, similarly to your case but with an even bigger file, and it succeeded both when building for x86 and for x86_64.
Bit7z v4.0 uses the standard file streams for reading/writing files, so there's should not be any issue in reading such large files, as far as I know.

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

No branches or pull requests

2 participants