aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp_bt.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-12 08:08:31 +0800
committerGitHub <noreply@github.com>2022-03-12 08:08:31 +0800
commit08d9d74fd91adb29e1f71a48a21df955568cdfcb (patch)
treec0ceb77f1a6aeaca150cf516d393e38d55bf8d9c /src/nvim/regexp_bt.c
parentd4982e152c8e92ee7a4092a58c272ed364c79b64 (diff)
parenta6e72aa295c633e67b3533a5a2088b7916941ad0 (diff)
downloadrneovim-08d9d74fd91adb29e1f71a48a21df955568cdfcb.tar.gz
rneovim-08d9d74fd91adb29e1f71a48a21df955568cdfcb.tar.bz2
rneovim-08d9d74fd91adb29e1f71a48a21df955568cdfcb.zip
Merge pull request #17680 from zeertzjq/vim-8.2.4440
vim-patch:8.2.{4440,4443}: crash with specific regexp pattern and string
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.