mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
zstd.Decompress: Assert buffer length requirements as early as possible
Without this assert, providing a buffer that's smaller than required results in more cryptic assertion failures later on.
This commit is contained in:
parent
bc7955306e
commit
f872dd03da
@ -92,6 +92,7 @@ const indirect_vtable: Reader.VTable = .{
|
||||
///
|
||||
/// Otherwise, `buffer` has those requirements.
|
||||
pub fn init(input: *Reader, buffer: []u8, options: Options) Decompress {
|
||||
if (buffer.len != 0) assert(buffer.len >= options.window_len + zstd.block_size_max);
|
||||
return .{
|
||||
.input = input,
|
||||
.state = .new_frame,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user