-
Notifications
You must be signed in to change notification settings - Fork 96
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
ZipArchive::close: zip_close called before saving buffer data. #202
Comments
moving it to below does indeed fix the issue, but another arises where close() does not update the buffer because of an issue with |
Hi @Trico-Everfire, |
https://github.com/ctabin/libzippp/blob/master/src/libzippp.cpp#L393-L443 |
The test case is the example code you provide in the readme. |
same problem using similar to readme code string path="some valid path";
const unsigned int folderSize=privateFunctions::dirSize(path);
void* buffer = calloc(folderSize, sizeof(char));
libzippp::ZipArchive* zip=libzippp::ZipArchive::fromWritableBuffer(&buffer, folderSize, libzippp::ZipArchive::New);
zip->addEntry(path);
zip->close(); //segfaults here
libzippp::ZipArchive::free(zip);
free(buffer); |
It's the same for everyone as zip->close() is crucial to the saving process, it will always crash in all use cases. I would go about fixing it myself, and the base problem is pretty fixable, the rest of the problem regarding the second problem I had with this leads all the way into zlib, so for the sake of my own sanity I wrote my own zip library that does not handle compression, just opening a zip and saving it to a buffer. |
Thanks for the feedback, I'll take a look at it asap. In the meantime, a PR is always welcome. |
It seems that |
int result = zip_close(zipHandle);
is called before :
int srcOpen = zip_source_open(zipSource);
causing zipSource to be empty and error. The responding error:
segfaults.
using vcpkg libzippp.
The text was updated successfully, but these errors were encountered: