Mercurial > vim
comparison src/regexp_nfa.c @ 29777:f1c5bd4acbbc v9.0.0228
patch 9.0.0228: crash when pattern looks below the last line
Commit: https://github.com/vim/vim/commit/13ed494bb5edc5a02d0ed0feabddb68920f88570
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 19 13:59:25 2022 +0100
patch 9.0.0228: crash when pattern looks below the last line
Problem: Crash when pattern looks below the last line.
Solution: Consider invalid lines to be empty. (closes https://github.com/vim/vim/issues/10938)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 19 Aug 2022 15:00:04 +0200 |
parents | 057c26b5c33a |
children | 22a5ccc0d634 |
comparison
equal
deleted
inserted
replaced
29776:b91c813678d1 | 29777:f1c5bd4acbbc |
---|---|
6772 if (ts < 4) | 6772 if (ts < 4) |
6773 ts = 4; | 6773 ts = 4; |
6774 result = col > t->state->val * ts; | 6774 result = col > t->state->val * ts; |
6775 } | 6775 } |
6776 if (!result) | 6776 if (!result) |
6777 result = nfa_re_num_cmp(t->state->val, op, | 6777 { |
6778 (long_u)win_linetabsize(wp, | 6778 linenr_T lnum = rex.reg_firstlnum + rex.lnum; |
6779 rex.reg_firstlnum + rex.lnum, | 6779 long_u vcol = 0; |
6780 rex.line, col) + 1); | 6780 |
6781 if (lnum > 0 | |
6782 && lnum <= wp->w_buffer->b_ml.ml_line_count) | |
6783 vcol = (long_u)win_linetabsize(wp, lnum, | |
6784 rex.line, col); | |
6785 result = nfa_re_num_cmp(t->state->val, op, vcol + 1); | |
6786 } | |
6781 if (result) | 6787 if (result) |
6782 { | 6788 { |
6783 add_here = TRUE; | 6789 add_here = TRUE; |
6784 add_state = t->state->out; | 6790 add_state = t->state->out; |
6785 } | 6791 } |