0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2692: Vim9: locked script variable can be changed

Problem:    Vim9: locked script variable can be changed.
Solution:   Check for locked value. (closes #8031)
This commit is contained in:
Bram Moolenaar
2021-04-02 14:35:15 +02:00
parent 3fa5e64e0e
commit f5906aa780
3 changed files with 20 additions and 0 deletions

View File

@@ -1958,6 +1958,13 @@ call_def_function(
if (sv == NULL)
goto failed;
--ectx.ec_stack.ga_len;
// "const" and "final" are checked at compile time, locking
// the value needs to be checked here.
SOURCING_LNUM = iptr->isn_lnum;
if (value_check_lock(sv->sv_tv->v_lock, sv->sv_name, FALSE))
goto on_error;
clear_tv(sv->sv_tv);
*sv->sv_tv = *STACK_TV_BOT(0);
}