From 294244708743db80347398537ac414d3a47c2a9d Mon Sep 17 00:00:00 2001 From: nekonya Date: Mon, 15 Dec 2025 03:11:07 +0900 Subject: [PATCH] Fix LZMA dictionary size parsing in 7z archives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The LZMA dictionary size was being read from only 3 bytes (indices 1-3) instead of the full 4 bytes (indices 1-4) specified in the LZMA format. This caused decompression to fail with LZMAError.notEnoughToRepeat for archives using dictionary sizes >= 16MB (e.g., LZMA:24 = 2^24 = 16MB), because the high byte was not read and the dictionary size defaulted to the minimum 4096 bytes. Change: `for i in 1..<4` → `for i in 1..<5` --- Sources/7-Zip/7zFolder.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/7-Zip/7zFolder.swift b/Sources/7-Zip/7zFolder.swift index 3cc5ddec..6e86946a 100644 --- a/Sources/7-Zip/7zFolder.swift +++ b/Sources/7-Zip/7zFolder.swift @@ -172,7 +172,7 @@ class SevenZipFolder { else { throw LZMAError.wrongProperties } var dictionarySize = 0 - for i in 1..<4 { + for i in 1..<5 { dictionarySize |= properties[i].toInt() << (8 * (i - 1)) } let lzmaProperties = try LZMAProperties(lzmaByte: properties[0], dictionarySize)