aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-15 16:38:33 -0500
committerJames McCoy <jamessan@jamessan.com>2016-12-28 14:57:39 -0500
commit486e968bb6bdfb49d17305d6f7747408eda95926 (patch)
tree5cf2d682be0ae8aed46ac3609449a371c5f5ab09
parent4453aa0d29d7a4e488a4c1799c9d33bcbde432eb (diff)
downloadrneovim-486e968bb6bdfb49d17305d6f7747408eda95926.tar.gz
rneovim-486e968bb6bdfb49d17305d6f7747408eda95926.tar.bz2
rneovim-486e968bb6bdfb49d17305d6f7747408eda95926.zip
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. https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/testdir/test_signs.vim12
-rw-r--r--src/nvim/version.c2
3 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 42af5989a1..a53e8657cb 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -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);
diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim
index 79e60986ee..93cc62cd9c 100644
--- a/src/nvim/testdir/test_signs.vim
+++ b/src/nvim/testdir/test_signs.vim
@@ -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
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 8e9f7938cc..756873f6d8 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -215,7 +215,7 @@ static int included_patches[] = {
// 2228,
2227,
// 2226,
- // 2225,
+ 2225,
// 2224,
// 2223,
// 2222,