File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,10 @@ void ZipLocalFileHeader::parse(std::istream& inp, bool assumeHeaderRead)
122122 poco_assert (std::memcmp (_rawHeader, HEADER, ZipCommon::HEADER_SIZE) == 0 );
123123 // read the rest of the header
124124 inp.read (_rawHeader + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
125- poco_assert (_rawHeader[VERSION_POS + 1 ]>= ZipCommon::HS_FAT && _rawHeader[VERSION_POS + 1 ] < ZipCommon::HS_UNUSED);
126- poco_assert (getMajorVersionNumber () <= 2 );
127- poco_assert (ZipUtil::get16BitValue (_rawHeader, COMPR_METHOD_POS) < ZipCommon::CM_UNUSED);
125+ if (!(_rawHeader[VERSION_POS + 1 ]>= ZipCommon::HS_FAT && _rawHeader[VERSION_POS + 1 ] < ZipCommon::HS_UNUSED))
126+ throw Poco::DataFormatException (" bad ZIP file header" , " invalid version" );
127+ if (ZipUtil::get16BitValue (_rawHeader, COMPR_METHOD_POS) >= ZipCommon::CM_UNUSED)
128+ throw Poco::DataFormatException (" bad ZIP file header" , " invalid compression method" );
128129 parseDateTime ();
129130 Poco::UInt16 len = getFileNameLength ();
130131 Poco::Buffer<char > buf (len);
You can’t perform that action at this time.
0 commit comments