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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0613
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.0613
Problem: When executing an insecure function the secure flag is stuck.
(Gabriel Barta)
Solution: Restore "secure" instead of decrementing it. (closes #3705)
Files: src/testdir/test_autocmd.vim, src/option.c, src/buffer.c
*** ../vim-8.1.0612/src/testdir/test_autocmd.vim 2018-12-16 15:37:58.866807609 +0100
--- src/testdir/test_autocmd.vim 2018-12-21 12:56:42.539308810 +0100
***************
*** 650,655 ****
--- 650,677 ----
"delfunc! AutoCommandOptionSet
endfunc
+ func Test_OptionSet_modeline()
+ call test_override('starting', 1)
+ au! OptionSet
+ augroup set_tabstop
+ au OptionSet tabstop call timer_start(1, {-> execute("echo 'Handler called'", "")})
+ augroup END
+ call writefile(['vim: set ts=7 sw=5 :', 'something'], 'XoptionsetModeline')
+ set modeline
+ let v:errmsg = ''
+ call assert_fails('split XoptionsetModeline', 'E12:')
+ call assert_equal(7, &ts)
+ call assert_equal('', v:errmsg)
+
+ augroup set_tabstop
+ au!
+ augroup END
+ bwipe!
+ set ts&
+ call delete('XoptionsetModeline')
+ call test_override('starting', 0)
+ endfunc
+
" Test for Bufleave autocommand that deletes the buffer we are about to edit.
func Test_BufleaveWithDelete()
new | edit Xfile1
*** ../vim-8.1.0612/src/option.c 2018-12-16 18:19:56.138140742 +0100
--- src/option.c 2018-12-21 12:54:17.032357226 +0100
***************
*** 5214,5220 ****
{
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
--- 5214,5220 ----
{
long_u *p = insecure_flag(opt_idx, opt_flags);
! int secure_saved = secure;
// When an option is set in the sandbox, from a
// modeline or in secure mode, then deal with side
***************
*** 5227,5247 ****
#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, &value_checked);
! if (did_inc_secure)
! --secure;
}
#if defined(FEAT_EVAL)
--- 5227,5244 ----
#endif
|| (opt_flags & OPT_MODELINE)
|| (!value_is_replaced && (*p & P_INSECURE)))
++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, &value_checked);
! secure = secure_saved;
}
#if defined(FEAT_EVAL)
*** ../vim-8.1.0612/src/buffer.c 2018-12-13 22:17:52.873941502 +0100
--- src/buffer.c 2018-12-21 12:55:36.679783373 +0100
***************
*** 5519,5524 ****
--- 5519,5525 ----
if (*s != NUL) /* skip over an empty "::" */
{
+ int secure_save = secure;
#ifdef FEAT_EVAL
save_current_sctx = current_sctx;
current_sctx.sc_sid = SID_MODELINE;
***************
*** 5530,5536 ****
retval = do_set(s, OPT_MODELINE | OPT_LOCAL | flags);
! --secure;
#ifdef FEAT_EVAL
current_sctx = save_current_sctx;
#endif
--- 5531,5537 ----
retval = do_set(s, OPT_MODELINE | OPT_LOCAL | flags);
! secure = secure_save;
#ifdef FEAT_EVAL
current_sctx = save_current_sctx;
#endif
*** ../vim-8.1.0612/src/version.c 2018-12-21 11:48:48.324680461 +0100
--- src/version.c 2018-12-21 12:52:28.649137990 +0100
***************
*** 801,802 ****
--- 801,804 ----
{ /* Add new patch number below this line */
+ /**/
+ 613,
/**/
--
Give a man a computer program and you give him a headache,
but teach him to program computers and you give him the power
to create headaches for others for the rest of his life...
R. B. Forest
/// 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 ///
|