mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
search: maches_next: assert match coordinates are valid
* They are within range (i.e. ‘row’ does not exceed term->rows-1) * ‘end’ comes after ‘start’
This commit is contained in:
parent
8c0fca30db
commit
f7c29ee394
1 changed files with 9 additions and 0 deletions
9
search.c
9
search.c
|
|
@ -561,6 +561,15 @@ search_matches_next(struct search_match_iterator *iter)
|
|||
match.end.row = match.end.row - grid->view + grid->num_rows;
|
||||
match.end.row &= grid->num_rows - 1;
|
||||
|
||||
xassert(match.start.row >= 0);
|
||||
xassert(match.start.row < term->rows);
|
||||
xassert(match.end.row >= 0);
|
||||
xassert(match.end.row < term->rows);
|
||||
|
||||
xassert(match.end.row > match.start.row ||
|
||||
(match.end.row == match.start.row &&
|
||||
match.end.col >= match.start.col));
|
||||
|
||||
if (return_primary_match) {
|
||||
iter->start.row = 0;
|
||||
iter->start.col = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue