From 8c0fca30db83576f7df5d48c94ecfa9896f8a075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 23 Apr 2022 12:23:27 +0200 Subject: [PATCH] =?UTF-8?q?selection:=20find=5Fword=5Fboundary:=20assert?= =?UTF-8?q?=20=E2=80=98pos=E2=80=99=20is=20valid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selection.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/selection.c b/selection.c index f279a834..da62d354 100644 --- a/selection.c +++ b/selection.c @@ -270,6 +270,11 @@ void selection_find_word_boundary_left(struct terminal *term, struct coord *pos, bool spaces_only) { + xassert(pos->row >= 0); + xassert(pos->row < term->rows); + xassert(pos->col >= 0); + xassert(pos->col < term->cols); + const struct row *r = grid_row_in_view(term->grid, pos->row); char32_t c = r->cells[pos->col].wc; @@ -343,6 +348,11 @@ void selection_find_word_boundary_right(struct terminal *term, struct coord *pos, bool spaces_only) { + xassert(pos->row >= 0); + xassert(pos->row < term->rows); + xassert(pos->col >= 0); + xassert(pos->col < term->cols); + const struct row *r = grid_row_in_view(term->grid, pos->row); char32_t c = r->cells[pos->col].wc;