From ca4346e35a6b9dbf1b9f679b46a7e591ce21749d Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Sun, 12 May 2024 20:24:31 -0500 Subject: [PATCH] window(fill): fix bounds check The bounds check should terminate at the window height. Fixes: f7f4606f1d49 "window(fill): bounds check the memcpy op" --- src/Window.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Window.zig b/src/Window.zig index ec62f89..aff891a 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -221,7 +221,7 @@ pub fn fill(self: Window, cell: Cell) void { } else { // Non-contiguous. Iterate over rows an memset var row: usize = self.y_off; - const last_row = @min(self.height + self.y_off, self.screen.height - self.y_off); + const last_row = @min(self.height + self.y_off, self.screen.height); while (row < last_row) : (row += 1) { const start = self.x_off + (row * self.screen.width); const end = @min(start + self.width, start + (self.screen.width - self.x_off));