Skip to content

Commit 388bfe0

Browse files
dweillerandrewrk
authored andcommitted
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.
1 parent 3f4f8e7 commit 388bfe0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/std/compress/zstandard.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ pub fn DecompressStream(
101101
);
102102
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);
105105
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);
108108
errdefer self.allocator.free(sequence_data);
109109

110110
self.literal_fse_buffer = literal_fse_buffer;

lib/std/compress/zstandard/types.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ pub const compressed_block = struct {
391391
pub const table_size_max = struct {
392392
pub const literal = 1 << table_accuracy_log_max.literal;
393393
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;
395395
};
396396
};
397397

0 commit comments

Comments
 (0)