mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 08:46:41 +01:00
fixed GH #317: Poco::Zip does not support newer Zip file versions.
This commit is contained in:
parent
2813f99061
commit
4dfcaf9220
@ -122,9 +122,10 @@ void ZipLocalFileHeader::parse(std::istream& inp, bool assumeHeaderRead)
|
|||||||
poco_assert (std::memcmp(_rawHeader, HEADER, ZipCommon::HEADER_SIZE) == 0);
|
poco_assert (std::memcmp(_rawHeader, HEADER, ZipCommon::HEADER_SIZE) == 0);
|
||||||
// read the rest of the header
|
// read the rest of the header
|
||||||
inp.read(_rawHeader + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
|
inp.read(_rawHeader + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
|
||||||
poco_assert (_rawHeader[VERSION_POS + 1]>= ZipCommon::HS_FAT && _rawHeader[VERSION_POS + 1] < ZipCommon::HS_UNUSED);
|
if (!(_rawHeader[VERSION_POS + 1]>= ZipCommon::HS_FAT && _rawHeader[VERSION_POS + 1] < ZipCommon::HS_UNUSED))
|
||||||
poco_assert (getMajorVersionNumber() <= 2);
|
throw Poco::DataFormatException("bad ZIP file header", "invalid version");
|
||||||
poco_assert (ZipUtil::get16BitValue(_rawHeader, COMPR_METHOD_POS) < ZipCommon::CM_UNUSED);
|
if (ZipUtil::get16BitValue(_rawHeader, COMPR_METHOD_POS) >= ZipCommon::CM_UNUSED)
|
||||||
|
throw Poco::DataFormatException("bad ZIP file header", "invalid compression method");
|
||||||
parseDateTime();
|
parseDateTime();
|
||||||
Poco::UInt16 len = getFileNameLength();
|
Poco::UInt16 len = getFileNameLength();
|
||||||
Poco::Buffer<char> buf(len);
|
Poco::Buffer<char> buf(len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user