vim-patch:8.1.0897: can modify a:000 when using a reference (#14902)

Problem:    Can modify a:000 when using a reference.
Solution:   Make check for locked variable stricter. (Ozaki Kiichi,
            closes vim/vim#3930)
05c00c038b
This commit is contained in:
Jan Edmund Lazo
2021-06-26 10:19:09 -04:00
committed by GitHub
parent ad9c2c069a
commit 20dc3f1989
6 changed files with 85 additions and 54 deletions

View File

@@ -2455,13 +2455,13 @@ void ex_function(exarg_T *eap)
goto erret;
}
if (fudi.fd_di == NULL) {
if (tv_check_lock(fudi.fd_dict->dv_lock, (const char *)eap->arg,
TV_CSTRING)) {
if (var_check_lock(fudi.fd_dict->dv_lock, (const char *)eap->arg,
TV_CSTRING)) {
// Can't add a function to a locked dictionary
goto erret;
}
} else if (tv_check_lock(fudi.fd_di->di_tv.v_lock, (const char *)eap->arg,
TV_CSTRING)) {
} else if (var_check_lock(fudi.fd_di->di_tv.v_lock, (const char *)eap->arg,
TV_CSTRING)) {
// Can't change an existing function if it is locked
goto erret;
}