commit 63fa151f1c29370cb3577b407d1b0e292e23299a (tree)
parent e204b2ca92d095cef03cee123881fd1d9f1004d0
Author: dweiller <4678790+dweiller@users.noreply.github.com>
Date: Thu, 15 Feb 2024 12:46:56 +1100
std.compress.zstandard: fix buffer sizes
This change corrects the size of various internal buffers used. The
previous behavior did not cause validity problems but wasted space.
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/std/compress/zstandard.zig b/lib/std/compress/zstandard.zig
@@ -101,10 +101,10 @@ pub fn DecompressStream(
);
const buffer = try RingBuffer.init(self.allocator, frame_context.window_size);
- const literals_data = try self.allocator.alloc(u8, options.window_size_max);
+ const literals_data = try self.allocator.alloc(u8, frame_context.block_size_max);
errdefer self.allocator.free(literals_data);
- const sequence_data = try self.allocator.alloc(u8, options.window_size_max);
+ const sequence_data = try self.allocator.alloc(u8, frame_context.block_size_max);
errdefer self.allocator.free(sequence_data);
self.literal_fse_buffer = literal_fse_buffer;
diff --git a/lib/std/compress/zstandard/types.zig b/lib/std/compress/zstandard/types.zig
@@ -391,7 +391,7 @@ pub const compressed_block = struct {
pub const table_size_max = struct {
pub const literal = 1 << table_accuracy_log_max.literal;
pub const match = 1 << table_accuracy_log_max.match;
- pub const offset = 1 << table_accuracy_log_max.match;
+ pub const offset = 1 << table_accuracy_log_max.offset;
};
};