From 9906a67ef6faba0e1978788adffc59ce620fbe7e Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 20 May 2024 00:07:39 +0200 Subject: [PATCH] screen: fix off by one error in readCell bounds checks --- src/Screen.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Screen.zig b/src/Screen.zig index 6d464bf..3bce6ba 100644 --- a/src/Screen.zig +++ b/src/Screen.zig @@ -66,11 +66,11 @@ pub fn writeCell(self: *Screen, col: usize, row: usize, cell: Cell) void { } pub fn readCell(self: *Screen, col: usize, row: usize) ?Cell { - if (self.width < col) { + if (self.width <= col) { // column out of bounds return null; } - if (self.height < row) { + if (self.height <= row) { // height out of bounds return null; }