mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +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
1 changed files with 1 additions and 0 deletions
|
|
@ -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…
Add table
Reference in a new issue