Skip to content

Commit

Permalink
3.2.3
Browse files Browse the repository at this point in the history
- Fixed miniz-cpp returning error when unzipping empty files
- Fixed andyzip crashing when unzipping invalid archives
  • Loading branch information
ChrisBase committed Dec 8, 2021
1 parent 1da47dd commit 7209eb5
Show file tree
Hide file tree
Showing 19 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-zip",
"version": "3.2.0",
"version": "3.2.3",
"description": "Unzips zip files",
"cordova": {
"id": "cordova-plugin-unzip",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-zip"
version="3.2.2">
version="3.2.3">
<engines>
<engine name="cordova" version=">=3.3.0"/>
</engines>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 6 additions & 1 deletion src/windows/ZipComponentUWP/Source/ZipAlgorithm_andyzip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ bool ZipAlgorithm_andyzip::Open(const char* pchZipFile, const char* pchOutputDir
return false;

const std::streamsize size = ifZipFile.tellg();
if( size < 22 ) // Minimum zip file size (see "https://en.wikipedia.org/wiki/ZIP_(file_format)")
return false;

ifZipFile.seekg(0, std::ios::beg);
m_vBuffer.resize(static_cast<size_t>(size));

Expand Down Expand Up @@ -275,7 +278,9 @@ bool ZipAlgorithm_andyzip::UnzipEntry(const size_t szEntryIndex)
return false;

const std::vector<uint8_t>& filedata(m_pReader->GetEntryData(strEntryName));
ofFile.write(reinterpret_cast<const char*>(filedata.data()), filedata.size());
if( filedata.size() == 0 )
return true;

ofFile.write(reinterpret_cast<const char*>(filedata.data()), filedata.size());
return ofFile.rdstate() == 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,8 @@ bool ZipAlgorithm_miniz_cpp::UnzipEntry(const size_t szEntryIndex)
return false;

ofFile << m_pZipFile->open(strEntryName).rdbuf();
return ofFile.rdstate() == 0;
if( ofFile.rdstate() != 0 && m_pZipFile->getinfo(strEntryName).file_size == 0 )
return true;

return false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ using namespace ZipComponentUWP;

String^ ZipComponent::GetVersion()
{
return "1.0.2.0";
return "1.0.3.0";
}
Binary file modified src/windows/ZipComponentUWP/ZipComponentUWP.rc
Binary file not shown.

0 comments on commit 7209eb5

Please sign in to comment.