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)
16e9b85113

Update vim_str2nr_spec.lua to add more tests that use strict = true.
This commit is contained in:
Sean Dewar
2021-05-30 22:50:09 +01:00
parent cd18fe17a8
commit 34cb087955
13 changed files with 136 additions and 59 deletions

View File

@@ -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;