fix(picompress): pass correct source size to uncompress()
piDecompress() appended original size as 8-byte ullong at the end of compressed data, but passed zba.size() (including the 8 bytes) to uncompress(). This fed trailing metadata as part of the zlib stream. Fix: subtract sizeof(ullong) from source length.
This commit is contained in:
@@ -68,7 +68,7 @@ PIByteArray piDecompress(const PIByteArray & zba) {
|
||||
ba.resize(sz);
|
||||
int ret = 0;
|
||||
ulong s = sz;
|
||||
ret = uncompress(ba.data(), &s, zba.data(), zba.size());
|
||||
ret = uncompress(ba.data(), &s, zba.data(), zba.size() - sizeof(ullong));
|
||||
if (ret != Z_OK) {
|
||||
piCout << "[PICompress]"
|
||||
<< "Error: invalid input or not enought memory"_tr("PICompress");
|
||||
|
||||
Reference in New Issue
Block a user