aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp_nfa.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-05 15:51:26 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-05 16:09:21 +0800
commit78e69412acb481c7ad56e68c541f5c5383992d5b (patch)
treebc96dfa6fca4e26ea661eb3f7326ff660a9b012d /src/nvim/regexp_nfa.c
parent45a3e7f6694c66c3577a47c7ff1fb8bfcc2ab7be (diff)
downloadrneovim-78e69412acb481c7ad56e68c541f5c5383992d5b.tar.gz
rneovim-78e69412acb481c7ad56e68c541f5c5383992d5b.tar.bz2
rneovim-78e69412acb481c7ad56e68c541f5c5383992d5b.zip
vim-patch:8.2.4688: new regexp engine does not give an error for "\%v"
Problem: New regexp engine does not give an error for "\%v". Solution: Check for a value argument. (issue vim/vim#10079) https://github.com/vim/vim/commit/91ff3d4f52a55a7c37a52aaad524cd9dd12efae4 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/regexp_nfa.c')
-rw-r--r--src/nvim/regexp_nfa.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index fbd4e26c75..a2f4e209f1 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -2151,7 +2151,7 @@ static int nfa_regatom(void)
}
while (ascii_isdigit(c)) {
if (cur) {
- semsg(_(e_regexp_number_after_dot_pos_search), no_Magic(c));
+ semsg(_(e_regexp_number_after_dot_pos_search_chr), no_Magic(c));
return FAIL;
}
if (n > (INT32_MAX - (c - '0')) / 10) {
@@ -2165,6 +2165,10 @@ static int nfa_regatom(void)
if (c == 'l' || c == 'c' || c == 'v') {
int32_t limit = INT32_MAX;
+ if (!cur && n == 0) {
+ semsg(_(e_nfa_regexp_missing_value_in_chr), no_Magic(c));
+ return FAIL;
+ }
if (c == 'l') {
if (cur) {
n = curwin->w_cursor.lnum;