aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp_bt.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-11 22:59:26 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-03-11 23:01:02 +0800
commitd0b5c1f696016a90a5b386339f4425a7bc69f252 (patch)
tree58749e45c7dddfe8e00bd2b1b92c4316c2cd76ec /src/nvim/regexp_bt.c
parent76769b8a1f5b34f4b0cef389597cec2796ca91b7 (diff)
downloadrneovim-d0b5c1f696016a90a5b386339f4425a7bc69f252.tar.gz
rneovim-d0b5c1f696016a90a5b386339f4425a7bc69f252.tar.bz2
rneovim-d0b5c1f696016a90a5b386339f4425a7bc69f252.zip
vim-patch:8.2.4440: crash with specific regexp pattern and string
Problem: Crash with specific regexp pattern and string. Solution: Stop at the start of the string. https://github.com/vim/vim/commit/6456fae9ba8e72c74b2c0c499eaf09974604ff30
Diffstat (limited to 'src/nvim/regexp_bt.c')
-rw-r--r--src/nvim/regexp_bt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/regexp_bt.c b/src/nvim/regexp_bt.c
index f6804e8415..1153b8ed33 100644
--- a/src/nvim/regexp_bt.c
+++ b/src/nvim/regexp_bt.c
@@ -4083,6 +4083,10 @@ static bool regmatch(
break;
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 right.