Skip to content

Commit bfd096d

Browse files
committed
patch 7.4.2225
Problem: Crash when placing a sign in a deleted buffer. Solution: Check for missing buffer name. (Dominique Pelle). Add a test.
1 parent af9c4c9 commit bfd096d

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/ex_cmds.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7861,6 +7861,11 @@ ex_sign(exarg_T *eap)
78617861
{ /* ... not currently in a window */
78627862
char_u *cmd;
78637863

7864+
if (buf->b_fname == NULL)
7865+
{
7866+
EMSG(_("E934: Cannot jump to a buffer that does not have a name"));
7867+
return;
7868+
}
78647869
cmd = alloc((unsigned)STRLEN(buf->b_fname) + 25);
78657870
if (cmd == NULL)
78667871
return;

src/testdir/test_signs.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,15 @@ func Test_sign_invalid_commands()
181181
call assert_fails('sign place 1 buffer=', 'E158:')
182182
call assert_fails('sign define Sign2 text=', 'E239:')
183183
endfunc
184+
185+
func Test_sign_delete_buffer()
186+
new
187+
sign define Sign text=x
188+
let bufnr = bufnr('%')
189+
new
190+
exe 'bd ' . bufnr
191+
exe 'sign place 61 line=3 name=Sign buffer=' . bufnr
192+
call assert_fails('sign jump 61 buffer=' . bufnr, 'E934:')
193+
sign unplace 61
194+
sign undefine Sign
195+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2225,
766768
/**/
767769
2224,
768770
/**/

0 commit comments

Comments
 (0)