From 004dcdfe936552fa916d27822ebbce3eb9cf9990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 6 Nov 2026 14:08:57 +0100 Subject: [PATCH] PSAR: Accept zlib 1.4's error for streams without a checksum zlib 1.4's uncompress2 returns Z_DATA_ERROR, not Z_BUF_ERROR, when the input runs out with the output full, so every file in the pre-decrypted 3.60 archive failed to inflate after the zlib update. Co-Authored-By: Claude Opus 5.5 --- Core/Util/PSARUnpack.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/Util/PSARUnpack.cpp b/Core/Util/PSARUnpack.cpp index 121b9d1155..56064df306 100644 --- a/Core/Util/PSARUnpack.cpp +++ b/Core/Util/PSARUnpack.cpp @@ -739,8 +739,9 @@ void PSARReader::EnsureContents() { uLongf destLen = contentExpandedSize_; uLong sourceLen = decoded; int zResult = uncompress2(entryData_.data(), &destLen, block2_.data(), &sourceLen); - // Handle zip streams missing their Adler-32 checksum. - if (zResult == Z_BUF_ERROR && sourceLen == (uLong)decoded && destLen == contentExpandedSize_ && decrypted_) { + // Handle zip streams missing their Adler-32 checksum (the pre-decrypted 3.60 archive's). The + // input runs out with the output full, which zlib 1.4 reports as Z_DATA_ERROR, 1.3 as Z_BUF_ERROR. + if ((zResult == Z_BUF_ERROR || zResult == Z_DATA_ERROR) && sourceLen == (uLong)decoded && destLen == contentExpandedSize_ && decrypted_) { zResult = Z_OK; } if (zResult != Z_OK || destLen != contentExpandedSize_) {