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:
2026-08-10 16:26:02 +03:00
parent aa64eb4c7f
commit 16adea05af
+1 -1
View File
@@ -68,7 +68,7 @@ PIByteArray piDecompress(const PIByteArray & zba) {
ba.resize(sz); ba.resize(sz);
int ret = 0; int ret = 0;
ulong s = sz; 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) { if (ret != Z_OK) {
piCout << "[PICompress]" piCout << "[PICompress]"
<< "Error: invalid input or not enought memory"_tr("PICompress"); << "Error: invalid input or not enought memory"_tr("PICompress");