fix: index out of range in vaxis.Layer.draw

This commit is contained in:
CJ van den Berg 2025-12-01 20:14:47 +01:00
parent 824a2a1ee1
commit 42ce0e5a7a
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -105,7 +105,7 @@ pub fn draw(self: *const Layer, plane_: Plane) void {
const src_row: i32 = @intCast(src_row_); const src_row: i32 = @intCast(src_row_);
const src_row_offset = src_row * src_w; const src_row_offset = src_row * src_w;
const dst_row_offset = (dst_y + src_row) * plane_.window.screen.width; const dst_row_offset = (dst_y + src_row) * plane_.window.screen.width;
if (dst_y + src_row > dst_dim_y) return; if (dst_y + src_row >= dst_dim_y) return;
@memcpy( @memcpy(
plane_.window.screen.buf[@intCast(dst_row_offset + dst_x)..@intCast(dst_row_offset + dst_x + dst_w)], plane_.window.screen.buf[@intCast(dst_row_offset + dst_x)..@intCast(dst_row_offset + dst_x + dst_w)],
self.view.screen.buf[@intCast(src_row_offset + src_x)..@intCast(src_row_offset + dst_w)], self.view.screen.buf[@intCast(src_row_offset + src_x)..@intCast(src_row_offset + dst_w)],