mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-08 11:02:17 +01:00
Merge pull request #1218 from stracol/patch-1
Fixes crash on streamed unzip
This commit is contained in:
commit
f11bf77505
@ -41,9 +41,15 @@ ZipDataInfo::ZipDataInfo(std::istream& in, bool assumeHeaderRead):
|
||||
_valid(false)
|
||||
{
|
||||
if (assumeHeaderRead)
|
||||
{
|
||||
std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
in.read(_rawInfo, ZipCommon::HEADER_SIZE);
|
||||
if ((! in) || (in.gcount() != ZipCommon::HEADER_SIZE))
|
||||
return;
|
||||
}
|
||||
poco_assert (std::memcmp(_rawInfo, HEADER, ZipCommon::HEADER_SIZE) == 0);
|
||||
// now copy the rest of the header
|
||||
in.read(_rawInfo+ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
|
||||
@ -75,9 +81,15 @@ ZipDataInfo64::ZipDataInfo64(std::istream& in, bool assumeHeaderRead):
|
||||
_valid(false)
|
||||
{
|
||||
if (assumeHeaderRead)
|
||||
{
|
||||
std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
in.read(_rawInfo, ZipCommon::HEADER_SIZE);
|
||||
if ((! in) || (in.gcount() != ZipCommon::HEADER_SIZE))
|
||||
return;
|
||||
}
|
||||
poco_assert (std::memcmp(_rawInfo, HEADER, ZipCommon::HEADER_SIZE) == 0);
|
||||
// now copy the rest of the header
|
||||
in.read(_rawInfo+ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
|
||||
|
Loading…
Reference in New Issue
Block a user