diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-22 13:37:31 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-22 13:37:31 +0000 |
commit | 6456fae9ba8e72c74b2c0c499eaf09974604ff30 (patch) | |
tree | 25484c863782a37837996f13bc0dc96d266892ec /src | |
parent | 1349bd712cf7d24dc65408c523dd7deb30224f80 (diff) |
patch 8.2.4440: crash with specific regexp pattern and stringv8.2.4440
Problem: Crash with specific regexp pattern and string.
Solution: Stop at the start of the string.
Diffstat (limited to 'src')
-rw-r--r-- | src/regexp_bt.c | 5 | ||||
-rw-r--r-- | src/testdir/test_regexp_utf8.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/regexp_bt.c b/src/regexp_bt.c index 5f5e58f834..4082f59d35 100644 --- a/src/regexp_bt.c +++ b/src/regexp_bt.c @@ -4615,6 +4615,11 @@ regmatch( if (rex.input == rex.line) { // backup to last char of previous line + if (rex.lnum == 0) + { + status = RA_NOMATCH; + break; + } --rex.lnum; rex.line = reg_getline(rex.lnum); // Just in case regrepeat() didn't count diff --git a/src/testdir/test_regexp_utf8.vim b/src/testdir/test_regexp_utf8.vim index 674eee571d..9f5b288160 100644 --- a/src/testdir/test_regexp_utf8.vim +++ b/src/testdir/test_regexp_utf8.vim @@ -508,7 +508,6 @@ endfunc " Check that [[:upper:]] matches for automatic engine func Test_match_char_class_upper() new - let _engine=®expengine " Test 1: [[:upper:]]\{2,\} set regexpengine=0 @@ -549,7 +548,7 @@ func Test_match_char_class_upper() call assert_equal(4, searchcount().total, 'TEST 3 lower') " clean up - let ®expengine=_engine + set regexpengine=0 bwipe! endfunc @@ -561,4 +560,13 @@ func Test_match_invalid_byte() call delete('Xinvalid') endfunc +func Test_match_too_complicated() + set regexpengine=1 + exe "vsplit \xeb\xdb\x99" + silent! buf \&\zs*\zs*0 + bwipe! + set regexpengine=0 +endfunc + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 23f45b5c17..809b03f3e5 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4440, +/**/ 4439, /**/ 4438, |