summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0540
blob: ac3fe23316d2c62902062062482c569409f4a034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0540
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0540
Problem:    May evaluate insecure value when appending to option.
Solution:   Set the secure flag when changing an option that was previously
            set insecurely.  Also allow numbers for the characters from
            'spelllang' that are used for LANG.vim. (closes #3623)
Files:	    src/option.c


*** ../vim-8.1.0539/src/option.c	2018-11-20 13:32:30.276983764 +0100
--- src/option.c	2018-11-20 14:16:31.077302001 +0100
***************
*** 4705,4710 ****
--- 4706,4713 ----
  	    }
  	    else
  	    {
+ 		int value_is_replaced = !prepending && !adding && !removing;
+ 
  		if (flags & P_BOOL)		    /* boolean */
  		{
  		    if (nextchar == '=' || nextchar == ':')
***************
*** 5209,5220 ****
  			}
  #endif
  
! 			/* Handle side effects, and set the global value for
! 			 * ":set" on local options. Note: when setting 'syntax'
! 			 * or 'filetype' autocommands may be triggered that can
! 			 * cause havoc. */
! 			errmsg = did_set_string_option(opt_idx, (char_u **)varp,
! 				new_value_alloced, oldval, errbuf, opt_flags);
  
  #if defined(FEAT_EVAL)
  			if (errmsg == NULL)
--- 5212,5247 ----
  			}
  #endif
  
! 			{
! 			    long_u *p = insecure_flag(opt_idx, opt_flags);
! 			    int	    did_inc_secure = FALSE;
! 
! 			    // When an option is set in the sandbox, from a
! 			    // modeline or in secure mode, then deal with side
! 			    // effects in secure mode.  Also when the value was
! 			    // set with the P_INSECURE flag and is not
! 			    // completely replaced.
! 			    if (secure
! #ifdef HAVE_SANDBOX
! 				    || sandbox != 0
! #endif
! 				    || (opt_flags & OPT_MODELINE)
! 				    || (!value_is_replaced && (*p & P_INSECURE)))
! 			    {
! 				did_inc_secure = TRUE;
! 				++secure;
! 			    }
! 
! 			    // Handle side effects, and set the global value for
! 			    // ":set" on local options. Note: when setting 'syntax'
! 			    // or 'filetype' autocommands may be triggered that can
! 			    // cause havoc.
! 			    errmsg = did_set_string_option(opt_idx, (char_u **)varp,
! 				    new_value_alloced, oldval, errbuf, opt_flags);
! 
! 			    if (did_inc_secure)
! 				--secure;
! 			}
  
  #if defined(FEAT_EVAL)
  			if (errmsg == NULL)
***************
*** 5254,5261 ****
  		}
  
  		if (opt_idx >= 0)
! 		    did_set_option(opt_idx, opt_flags,
! 					 !prepending && !adding && !removing);
  	    }
  
  skip:
--- 5281,5287 ----
  		}
  
  		if (opt_idx >= 0)
! 		    did_set_option(opt_idx, opt_flags, value_is_replaced);
  	    }
  
  skip:
***************
*** 7758,7764 ****
  	     * '.encoding'.
  	     */
  	    for (p = q; *p != NUL; ++p)
! 		if (!ASCII_ISALPHA(*p) && *p != '-')
  		    break;
  	    if (p > q)
  	    {
--- 7784,7790 ----
  	     * '.encoding'.
  	     */
  	    for (p = q; *p != NUL; ++p)
! 		if (!ASCII_ISALNUM(*p) && *p != '-')
  		    break;
  	    if (p > q)
  	    {
*** ../vim-8.1.0539/src/version.c	2018-11-20 13:32:30.276983764 +0100
--- src/version.c	2018-11-20 14:21:13.067051824 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     540,
  /**/

-- 
A hamburger walks into a bar, and the bartender says: "I'm sorry,
but we don't serve food here."

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///