Fix memcpy alias bug in std.compress.lzma

This commit is contained in:
Kamil T 2024-09-18 09:41:46 +01:00 committed by Andrew Kelley
parent 0595feb341
commit d50bae4da9

View File

@ -77,7 +77,7 @@ pub fn Decompress(comptime ReaderType: type) type {
const input = self.to_read.items;
const n = @min(input.len, output.len);
@memcpy(output[0..n], input[0..n]);
@memcpy(input[0 .. input.len - n], input[n..]);
std.mem.copyForwards(u8, input[0 .. input.len - n], input[n..]);
self.to_read.shrinkRetainingCapacity(input.len - n);
return n;
}