Skip to content

Commit d214910

Browse files
ianicandrewrk
authored andcommitted
flate zlib fix end of block reading
`n` is wanted number of bits to toss `buffered_n` is actual number of bytes in `next_int`
1 parent d8cecff commit d214910

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/compress/flate/Decompress.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ fn tossBitsEnding(d: *Decompress, n: u4) !void {
603603
error.EndOfStream => unreachable,
604604
};
605605
d.next_bits = next_int >> needed_bits;
606-
d.remaining_bits = @intCast(@as(usize, n) * 8 -| @as(usize, needed_bits));
606+
d.remaining_bits = @intCast(@as(usize, buffered_n) * 8 -| @as(usize, needed_bits));
607607
}
608608

609609
fn takeBitsRuntime(d: *Decompress, n: u4) !u16 {

0 commit comments

Comments
 (0)