From 8c1ef94b2624b95d58e4a3a5857b542053faec2e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Feb 2020 20:27:20 +0530 Subject: [PATCH] Bounds check for apply selection Fixes #2400 --- kitty/screen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kitty/screen.c b/kitty/screen.c index 6bbfdb63c..d4572b2f8 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1696,6 +1696,7 @@ apply_selection(Screen *self, uint8_t *data, const Selection *s, IterationData * iteration_data(self, s, last_rendered, 0, true); for (int y = last_rendered->y; y < last_rendered->y_limit; y++) { + if (y > (int)self->lines - 1) break; Line *line = visual_line_(self, y); uint8_t *line_start = data + self->columns * y; XRange xr = xrange_for_iteration(last_rendered, y, line);