| author | |
| committer | |
| log | f6de3ec963e3a7d96cd4f6c72b0f076f0437c45d |
| tree | 1bd456887034b6ac50355b4958208425fe807f2f |
| parent | 1ccc68f307d4a2208118a8798d43119d63b53e05 |
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.1 files changed, 3 insertions(+), 1 deletions(-)
lib/std/compress/zstandard/decode/block.zig+3-1| ... | ... | @@ -721,7 +721,9 @@ pub fn decodeBlockRingBuffer( |
| 721 | 721 | }, |
| 722 | 722 | .rle => { |
| 723 | 723 | if (src.len < 1) return error.MalformedRleBlock; |
| 724 | dest.writeSliceAssumeCapacity(src[0..block_size]); | |
| 724 | for (0..block_size) |_| { | |
| 725 | dest.writeAssumeCapacity(src[0]); | |
| 726 | } | |
| 725 | 727 | consumed_count.* += 1; |
| 726 | 728 | decode_state.written_count += block_size; |
| 727 | 729 | return block_size; |