diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-04-23 10:24:28 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-04-24 18:17:37 +0000 |
| commit | f7c29ee39497a23b95e4ef97fc3ed87360014d7b (patch) | |
| tree | beec8febc16a0d4a524568e97b8646cd2e7b5810 /search.c | |
| parent | selection: find_word_boundary: assert ‘pos’ is valid (diff) | |
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’
Diffstat (limited to 'search.c')
| -rw-r--r-- | search.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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; |
