0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.0537: Vim9: no check for sandbox when setting v:var

Problem:    Vim9: no check for sandbox when setting v:var.
Solution:   Check for sandbox.
This commit is contained in:
Bram Moolenaar 2020-04-09 20:10:55 +02:00
parent 5da356e073
commit cab2767874
3 changed files with 21 additions and 0 deletions

View File

@ -1978,6 +1978,17 @@ set_vim_var_tv(int idx, typval_T *tv)
clear_tv(tv);
return FAIL;
}
// VV_RO is also checked when compiling, but let's check here as well.
if (vimvars[idx].vv_flags & VV_RO)
{
semsg(_(e_readonlyvar), vimvars[idx].vv_name);
return FAIL;
}
if (sandbox && (vimvars[idx].vv_flags & VV_RO_SBX))
{
semsg(_(e_readonlysbx), vimvars[idx].vv_name);
return FAIL;
}
clear_tv(&vimvars[idx].vv_di.di_tv);
vimvars[idx].vv_di.di_tv = *tv;
return OK;

View File

@ -170,6 +170,11 @@ def Test_assignment_default()
assert_equal(5678, nr)
enddef
def Mess(): string
v:foldstart = 123
return 'xxx'
enddef
func Test_assignment_failure()
call CheckDefFailure(['let var=234'], 'E1004:')
call CheckDefFailure(['let var =234'], 'E1004:')
@ -207,6 +212,9 @@ func Test_assignment_failure()
call CheckDefFailure(['let var: dict <number>'], 'E1068:')
call CheckDefFailure(['let var: dict<number'], 'E1009:')
call assert_fails('s/^/\=Mess()/n', 'E794:')
call CheckDefFailure(['let var: dict<number'], 'E1009:')
endfunc
func Test_wrong_type()

View File

@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
537,
/**/
536,
/**/