authorgravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2024-02-15 12:46:56+11:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-23 02:37:11-07:00
log63fa151f1c29370cb3577b407d1b0e292e23299a
treef2e618b56024bd48662188c2746831878fa9b99e
parente204b2ca92d095cef03cee123881fd1d9f1004d0

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.

2 files changed, 3 insertions(+), 3 deletions(-)

lib/std/compress/zstandard.zig+2-2
...@@ -101,10 +101,10 @@ pub fn DecompressStream(...@@ -101,10 +101,10 @@ pub fn DecompressStream(
101 );101 );
102 const buffer = try RingBuffer.init(self.allocator, frame_context.window_size);102 const buffer = try RingBuffer.init(self.allocator, frame_context.window_size);
103103
104 const literals_data = try self.allocator.alloc(u8, options.window_size_max);104 const literals_data = try self.allocator.alloc(u8, frame_context.block_size_max);
105 errdefer self.allocator.free(literals_data);105 errdefer self.allocator.free(literals_data);
106106
107 const sequence_data = try self.allocator.alloc(u8, options.window_size_max);107 const sequence_data = try self.allocator.alloc(u8, frame_context.block_size_max);
108 errdefer self.allocator.free(sequence_data);108 errdefer self.allocator.free(sequence_data);
109109
110 self.literal_fse_buffer = literal_fse_buffer;110 self.literal_fse_buffer = literal_fse_buffer;
lib/std/compress/zstandard/types.zig+1-1
...@@ -391,7 +391,7 @@ pub const compressed_block = struct {...@@ -391,7 +391,7 @@ pub const compressed_block = struct {
391 pub const table_size_max = struct {391 pub const table_size_max = struct {
392 pub const literal = 1 << table_accuracy_log_max.literal;392 pub const literal = 1 << table_accuracy_log_max.literal;
393 pub const match = 1 << table_accuracy_log_max.match;393 pub const match = 1 << table_accuracy_log_max.match;
394 pub const offset = 1 << table_accuracy_log_max.match;394 pub const offset = 1 << table_accuracy_log_max.offset;
395 };395 };
396};396};
397397