authorgravatar for elliot.huang.signed@gmail.combinarycraft007 <elliot.huang.signed@gmail.com> 2025-09-03 10:25:32+08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-09-03 01:48:46-07:00
log35f013db11ff90ab9c75b028dc58b50d4f06ee42
tree360b6c79cf33e81bd13a7b660ece4fed0d7f981b
parentd51d18c98654e09cb1af7f2896f97b81ce6c83bb

lzma2: fix premature finish

lzma2 Decoder already checks if decoding is finished or not inside the process function, `range_decoder`finish does not mean the decoder has finished, also need to check `ld.rep[0] == 0xFFFF_FFFF`, which was already done inside the proccess function. This fix delete the redundant `isFinish()` check for `range_decoder`.

1 files changed, 0 insertions(+), 1 deletions(-)

lib/std/compress/lzma2.zig-1
...@@ -233,7 +233,6 @@ pub const Decode = struct {...@@ -233,7 +233,6 @@ pub const Decode = struct {
233233
234 while (true) {234 while (true) {
235 if (accum.len >= expected_unpacked_size) break;235 if (accum.len >= expected_unpacked_size) break;
236 if (range_decoder.isFinished()) break;
237 switch (try ld.process(reader, allocating, accum, &range_decoder, &n_read)) {236 switch (try ld.process(reader, allocating, accum, &range_decoder, &n_read)) {
238 .more => continue,237 .more => continue,
239 .finished => break,238 .finished => break,