From 3a86a7ca167f7476bdae438851f760a644b0bd5a Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 20 Oct 2019 11:24:02 +0300 Subject: [PATCH] ui: harden bounds check in inspect_bounds macro --- ui/src/terminal/cells.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/terminal/cells.rs b/ui/src/terminal/cells.rs index a5109e52..b92d1e18 100644 --- a/ui/src/terminal/cells.rs +++ b/ui/src/terminal/cells.rs @@ -757,7 +757,7 @@ macro_rules! inspect_bounds { ($grid:ident, $area:ident, $x: ident, $y: ident, $line_break:ident) => { let bounds = $grid.size(); let (upper_left, bottom_right) = $area; - if $x == (get_x(bottom_right)) + 1 || $x > get_x(bounds) { + if $x > (get_x(bottom_right)) || $x > get_x(bounds) { $x = get_x(upper_left); $y += 1; if $y > (get_y(bottom_right)) || $y > get_y(bounds) {