From afa9ac0cfc05ac58b4cb03f88cab7069fd137266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 24 Feb 2020 18:39:58 +0100 Subject: [PATCH] sixel: ensure 'start' row is not outside the grid row range --- sixel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sixel.c b/sixel.c index d8a494e1..caa31429 100644 --- a/sixel.c +++ b/sixel.c @@ -143,7 +143,9 @@ sixel_unhook(struct terminal *term) .height = term->sixel.image.height, .rows = (term->sixel.image.height + term->cell_height - 1) / term->cell_height, .grid = term->grid, - .pos = (struct coord){term->cursor.point.col, term->grid->offset + term->cursor.point.row}, + .pos = (struct coord){ + term->cursor.point.col, + (term->grid->offset + term->cursor.point.row) & (term->grid->num_rows - 1)}, }; LOG_DBG("generating %dx%d pixman image", image.width, image.height);