mirror of
https://github.com/ziglang/zig.git
synced 2026-01-04 12:33:19 +00:00
zstandard: fix incorrect RLE decompression into ring buffer
This reverts a change introduced in #17400 causing a bug when decompressing an RLE block into a ring buffer. RLE blocks contain only a single byte of data to copy into the output, so attempting to copy a slice causes buffer overruns and incorrect decompression.
This commit is contained in:
parent
1ccc68f307
commit
f6de3ec963
@ -721,7 +721,9 @@ pub fn decodeBlockRingBuffer(
|
||||
},
|
||||
.rle => {
|
||||
if (src.len < 1) return error.MalformedRleBlock;
|
||||
dest.writeSliceAssumeCapacity(src[0..block_size]);
|
||||
for (0..block_size) |_| {
|
||||
dest.writeAssumeCapacity(src[0]);
|
||||
}
|
||||
consumed_count.* += 1;
|
||||
decode_state.written_count += block_size;
|
||||
return block_size;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user