1
0
forked from aniani/vim

patch 9.0.1611: v:maxcol can be changed in a :for loop

Problem:    v:maxcol can be changed in a :for loop.
Solution:   Check for read-only loop variable. (closes #12470)
This commit is contained in:
Bram Moolenaar
2023-06-05 19:46:18 +01:00
parent d9a92dc70b
commit 16d2c02c80
3 changed files with 5 additions and 1 deletions

View File

@@ -3842,7 +3842,8 @@ set_var_const(
}
if ((flags & ASSIGN_FOR_LOOP) == 0
&& var_check_permission(di, name) == FAIL)
? var_check_permission(di, name) == FAIL
: var_check_ro(di->di_flags, name, FALSE))
goto failed;
}
else

View File

@@ -126,6 +126,7 @@ func Test_for_invalid()
call assert_fails("for x in 99", 'E1098:')
call assert_fails("for x in function('winnr')", 'E1098:')
call assert_fails("for x in {'a': 9}", 'E1098:')
call assert_fails("for v:maxcol in range(1)", 'E46:')
if 0
/1/5/2/s/\n

View File

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