zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit f81b3a2095248e3dbb8b422d693dc752828dc94d (tree)
parent cb3fe277bbbdcf432530cd0a1f3d05d3d924675b
Author: Igor Anić <igor.anic@gmail.com>
Date:   Wed, 14 Feb 2024 13:32:19 +0100

fix reading input stream during decompression

By using read instead of readAll decompression reader could get bytes
then available in the stream and then later wrongly failed with end of
stream.

Diffstat:
Mlib/std/compress/flate/bit_reader.zig | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/std/compress/flate/bit_reader.zig b/lib/std/compress/flate/bit_reader.zig @@ -55,7 +55,7 @@ pub fn BitReader(comptime ReaderType: type) type { (self.nbits >> 3); // 0 for 0-7, 1 for 8-16, ... same as / 8 var buf: [8]u8 = [_]u8{0} ** 8; - const bytes_read = self.forward_reader.read(buf[0..empty_bytes]) catch 0; + const bytes_read = self.forward_reader.readAll(buf[0..empty_bytes]) catch 0; if (bytes_read > 0) { const u: u64 = std.mem.readInt(u64, buf[0..8], .little); self.bits |= u << @as(u6, @intCast(self.nbits));