changeset 35927:dba5dc4559b3 v9.1.0665

patch 9.1.0665: Locked variable can be changed in a :for loop Commit: https://github.com/vim/vim/commit/6b97d7ad197de0fb38648c91552c4374e39fdf98 Author: zeertzjq <zeertzjq@outlook.com> Date: Thu Aug 8 21:05:57 2024 +0200 patch 9.1.0665: Locked variable can be changed in a :for loop Problem: Locked variable can be changed in a :for loop. Solution: Always do a full permission check on the first loop iteration where ASSIGN_DECL is not set (zeertzjq). related: #12470 fixes: #15450 closes: #15454 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 08 Aug 2024 21:15:04 +0200
parents 7f18f3143b0b
children 07f5ccc60297
files src/evalvars.c src/testdir/test_eval_stuff.vim src/version.c
diffstat 3 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -4100,7 +4100,7 @@ set_var_const(
 
 	    // Modifying a final variable with a List value using the "+="
 	    // operator is allowed.  For other types, it is not allowed.
-	    if (((flags & ASSIGN_FOR_LOOP) == 0
+	    if ((((flags & ASSIGN_FOR_LOOP) == 0 || (flags & ASSIGN_DECL) == 0)
 			&& ((flags & ASSIGN_COMPOUND_OP) == 0
 			    || !type_inplace_modifiable))
 				 ? var_check_permission(di, name) == FAIL
index a346399eb513bbf2c45a4c98f5d823d206e7edbc..1b17108c4f3ff5daa3d940114576827aac225153
GIT binary patch
literal 26577
zc%02${c__rlD~h~50Lv8;q49OJzEwj`Lit7`9n^oE}Lx4q^727>{3w_BymR~wIt<_
zouulX<{sf*;NIk(<hlV61W16QXC{|*GL{H*H-6n{G#VfYJLG4Y<r$eJDR~IeDA{C$
zJ_JjWFQRy!b$52MWRr%JJVf+yyvd_w_aRyph1nuV>6Dd3t96p*#O)ry)hQOaB*@6a
z>CVn<6Nh<}#3VbLB}r$O1QQ_LAtX<q;Wr^E%{OUGKHQVxko2G^4DxWHR(Wti<0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uv%;Ju
z4E)t`x%UHrqMJAy1+PPQ<1dIZmmRSqJHsHe9J}eNqlv#~>Us9pWL0YKh2;GHD4xP3
z_^jtzYJ7N#mf!O1a;>S>C!Px~2cysj$HSh%iGeYnoEQ!ZH8BsrfEnWf3p)-!%Fc0g
z=!UoL!cDq-9)rke9<Qi!j$d|`@iQe|{47p5nV-!?>0BvYviAWig>zHkCpSBDyNv!<
zcF4pWE*a&o74^iK0*o2|yuw_ZHp#ISD5P9c3MNc4DMgd7A)9nbRXP-XP5Gt<Ue>}+
zaTq7>Jmqq(Uh+;fo(@9k8bT8|MOGZTCC;mS3^I~J<i!w!uX!gklI218(dd*8eWJvL
zDUE56(lrfW((eFLuh;X%d9>cq=@}Wx90}%^govge=o#sBT<v70{}{jh%jo*`<qzyM
z&jl@x$AnP42+|<TVOnD6;7ur@Ss1MGpzX&+1j!gXfH(sg(_{lP);_C7McAI+4Cbqk
z^f~M7;#=yVCJGmSD1^OSjk*RgImdkNf~<ly^6r5+oJNZiC0Fbqr$;<#5+*f-1oF6)
zY)?JvUZBQz^3!pgj5*eEwx%IFVE_yo<0;M14mtnx{{Q~xe_fFC>(%r^^jrcm#&ikc
zI)iS(b4$;!-&_>kAeC|M1Tz{tw;W5O5=qp%<xtn#D*l*?wV5YdJKkPR8WJ+A+`=z$
z7^^UPDU(k@%mctG%p$xK&TsvTlCuU0Y8&zRW;|26l#sB&4Q~>psY6F&Q^+`G;~^U0
zM#ZU9c$@<7>M@|Lj<8L}{v--Gp!>-MN6(@uCFd7~SHg%(bK#EcFzt1+WXH>M;XCD@
zl41Er?~}LxM=;0R{ryiD{~Z4k|IdH_>p!Vu>LFU4LFN|C^2cbJFNQt{%HTH`8GIWu
Hnw|dxWu3+F
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    665,
+/**/
     664,
 /**/
     663,