Skip to content

assertion failure during JAR file decompression #2188

@wolfgang-f

Description

@wolfgang-f

When I decompress the attached jar file the assertion ZipLocalFileHeader.cpp line 102 fails:

else
{
    poco_assert_dbg(!searchCRCAndSizesAfterData());
    ZipUtil::sync(inp);
}

org.eclipse.core.runtime_3.11.1.v20150903-1804.jar.zip

Here is my code:

int main(int argc, char* argv)
{
try {
std::ifstream inp("C:\Program Files\eclipse\plugins\org.eclipse.core.runtime_3.11.1.v20150903-1804.jar", std::ios::binary);

    Poco::Zip::Decompress dec(inp, Poco::Path());
    dec.decompressAllFiles();
}
catch (std::exception& ex)
{
    std::cerr << ex.what() << std::endl;
}
return 0;

}

From debugging it seems to me that ZipLocalFileHeader::isDirectory() might contain a bug:
inline bool ZipLocalFileHeader::isDirectory() const
{
poco_assert_dbg(!_fileName.empty());
return getUncompressedSize() == 0 && getCompressionMethod() == ZipCommon::CM_STORE && _fileName[_fileName.length()-1] == '/';
}
It returns false for the _fileName "META-INF/" (which is actually a directory when examinig the jar file) because in the jar file the compression method for the directory is CM_DEFLATE and not CM_STORE

POCO version

1.8.1

Compiler and version

Visual Studio 2017

Operating system and version

Windows 7 64 Bit (running a 32 bit process)

Other relevant information

org.eclipse.core.runtime_3.11.1.v20150903-1804.jar.zip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions