aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-05-30 22:50:09 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-11 15:33:19 +0100
commit34cb0879551b8217db820f684d913a393f4f38cb (patch)
treecd8c7320d91be9344cfe859c5861b475c093e565 /src/nvim/eval.c
parentcd18fe17a88d8144e5b841f1ca737fb4adf7885b (diff)
downloadrneovim-34cb0879551b8217db820f684d913a393f4f38cb.tar.gz
rneovim-34cb0879551b8217db820f684d913a393f4f38cb.tar.bz2
rneovim-34cb0879551b8217db820f684d913a393f4f38cb.zip
vim-patch:8.1.1355: obvious mistakes are accepted as valid expressions
Problem: Obvious mistakes are accepted as valid expressions. Solution: Be more strict about parsing numbers. (Yasuhiro Matsumoto, closes vim/vim#3981) https://github.com/vim/vim/commit/16e9b85113e0b354ece1cb4f5fcc7866850f3685 Update vim_str2nr_spec.lua to add more tests that use strict = true.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 5603fbb082..fbafe42eb2 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -3950,7 +3950,12 @@ static int eval7(
rettv->vval.v_float = f;
}
} else {
- vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0);
+ vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0, true);
+ if (len == 0) {
+ EMSG2(_(e_invexpr2), *arg);
+ ret = FAIL;
+ break;
+ }
*arg += len;
if (evaluate) {
rettv->v_type = VAR_NUMBER;