vim-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.

bfd096d020
This commit is contained in:
James McCoy 2016-11-15 16:38:33 -05:00
parent 4453aa0d29
commit 486e968bb6
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
3 changed files with 17 additions and 1 deletions

View File

@ -5675,6 +5675,10 @@ void ex_sign(exarg_T *eap)
}
else
{ // ... not currently in a window
if (buf->b_fname == NULL) {
EMSG(_("E934: Cannot jump to a buffer that does not have a name"));
return;
}
char *cmd = xmalloc(STRLEN(buf->b_fname) + 25);
sprintf(cmd, "e +%" PRId64 " %s",
(int64_t)lnum, buf->b_fname);

View File

@ -181,3 +181,15 @@ func Test_sign_invalid_commands()
call assert_fails('sign place 1 buffer=', 'E158:')
call assert_fails('sign define Sign2 text=', 'E239:')
endfunc
func Test_sign_delete_buffer()
new
sign define Sign text=x
let bufnr = bufnr('%')
new
exe 'bd ' . bufnr
exe 'sign place 61 line=3 name=Sign buffer=' . bufnr
call assert_fails('sign jump 61 buffer=' . bufnr, 'E934:')
sign unplace 61
sign undefine Sign
endfunc

View File

@ -215,7 +215,7 @@ static int included_patches[] = {
// 2228,
2227,
// 2226,
// 2225,
2225,
// 2224,
// 2223,
// 2222,