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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0660
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.0660
Problem: sign_unplace() may leak memory.
Solution: Free the group name before returning. Add a few more tests.
(Yegappan Lakshmanan)
Files: src/evalfunc.c, src/testdir/test_signs.vim
*** ../vim-8.1.0659/src/evalfunc.c 2018-12-29 18:53:07.843607433 +0100
--- src/evalfunc.c 2018-12-29 20:42:30.370357956 +0100
***************
*** 11578,11584 ****
if (argvars[1].v_type != VAR_DICT)
{
EMSG(_(e_dictreq));
! return;
}
dict = argvars[1].vval.v_dict;
--- 11578,11584 ----
if (argvars[1].v_type != VAR_DICT)
{
EMSG(_(e_dictreq));
! goto cleanup;
}
dict = argvars[1].vval.v_dict;
***************
*** 11589,11595 ****
{
EMSG2(_("E158: Invalid buffer name: %s"),
tv_get_string(&di->di_tv));
! return;
}
}
if (dict_find(dict, (char_u *)"id", -1) != NULL)
--- 11589,11595 ----
{
EMSG2(_("E158: Invalid buffer name: %s"),
tv_get_string(&di->di_tv));
! goto cleanup;
}
}
if (dict_find(dict, (char_u *)"id", -1) != NULL)
***************
*** 11608,11613 ****
--- 11608,11615 ----
if (sign_unplace(sign_id, group, buf, 0) == OK)
rettv->vval.v_number = 0;
}
+
+ cleanup:
vim_free(group);
}
#endif
*** ../vim-8.1.0659/src/testdir/test_signs.vim 2018-12-29 18:53:07.843607433 +0100
--- src/testdir/test_signs.vim 2018-12-29 20:48:20.911472019 +0100
***************
*** 385,390 ****
--- 385,392 ----
\ {"lnum" : -1})', 'E885:')
call assert_fails('call sign_place(22, "", "sign1", "Xsign",
\ {"lnum" : 0})', 'E885:')
+ call assert_fails('call sign_place(22, "", "sign1", "Xsign",
+ \ {"lnum" : []})', 'E745:')
call assert_equal(-1, sign_place(1, "*", "sign1", "Xsign", {"lnum" : 10}))
" Tests for sign_getplaced()
***************
*** 420,428 ****
\ {'id' : 20, 'buffer' : 'buffer.c'})", 'E158:')
call assert_fails("call sign_unplace('',
\ {'id' : 20, 'buffer' : ''})", 'E158:')
! call assert_fails("call sign_unplace('',
\ {'id' : 20, 'buffer' : 200})", 'E158:')
! call assert_fails("call sign_unplace('', 'mySign')", 'E715:')
" Tests for sign_undefine()
call assert_equal(0, sign_undefine("sign1"))
--- 422,430 ----
\ {'id' : 20, 'buffer' : 'buffer.c'})", 'E158:')
call assert_fails("call sign_unplace('',
\ {'id' : 20, 'buffer' : ''})", 'E158:')
! call assert_fails("call sign_unplace('g1',
\ {'id' : 20, 'buffer' : 200})", 'E158:')
! call assert_fails("call sign_unplace('g1', 'mySign')", 'E715:')
" Tests for sign_undefine()
call assert_equal(0, sign_undefine("sign1"))
***************
*** 664,670 ****
call delete("Xsign")
call sign_unplace('*')
call sign_undefine()
! enew | only
endfunc
" Place signs used for ":sign unplace" command test
--- 666,672 ----
call delete("Xsign")
call sign_unplace('*')
call sign_undefine()
! enew | only
endfunc
" Place signs used for ":sign unplace" command test
***************
*** 1013,1019 ****
call sign_unplace('*')
call sign_undefine()
! enew | only
call delete("Xsign1")
call delete("Xsign2")
endfunc
--- 1015,1021 ----
call sign_unplace('*')
call sign_undefine()
! enew | only
call delete("Xsign1")
call delete("Xsign2")
endfunc
***************
*** 1042,1047 ****
--- 1044,1052 ----
call assert_equal(1, sign_place(0, 'g1', 'sign1', 'Xsign',
\ {'lnum' : 11}))
+ " Check for the next generated sign id in this group
+ call assert_equal(2, sign_place(0, 'g1', 'sign1', 'Xsign',
+ \ {'lnum' : 12}))
call assert_equal(0, sign_unplace('g1', {'id' : 1}))
call assert_equal(10,
\ sign_getplaced('Xsign', {'id' : 1})[0].signs[0].lnum)
***************
*** 1049,1055 ****
call delete("Xsign")
call sign_unplace('*')
call sign_undefine()
! enew | only
endfunc
" Test for sign priority
--- 1054,1060 ----
call delete("Xsign")
call sign_unplace('*')
call sign_undefine()
! enew | only
endfunc
" Test for sign priority
***************
*** 1085,1090 ****
--- 1090,1097 ----
" Error case
call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
\ [])", 'E715:')
+ call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
+ \ {'priority' : []})", 'E745:')
call sign_unplace('*')
" Tests for the :sign place command with priority
***************
*** 1104,1110 ****
call sign_unplace('*')
call sign_undefine()
! enew | only
call delete("Xsign")
endfunc
--- 1111,1117 ----
call sign_unplace('*')
call sign_undefine()
! enew | only
call delete("Xsign")
endfunc
***************
*** 1146,1151 ****
call sign_unplace('*')
call sign_undefine()
! enew | only
call delete("Xsign")
endfunc
--- 1153,1158 ----
call sign_unplace('*')
call sign_undefine()
! enew | only
call delete("Xsign")
endfunc
*** ../vim-8.1.0659/src/version.c 2018-12-29 20:04:36.257512068 +0100
--- src/version.c 2018-12-29 20:57:28.734930503 +0100
***************
*** 801,802 ****
--- 801,804 ----
{ /* Add new patch number below this line */
+ /**/
+ 660,
/**/
--
hundred-and-one symptoms of being an internet addict:
81. At social functions you introduce your husband as "my domain server."
/// 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 ///
|