From 41bffeacff885b4904a1f456c6d56e016ad6f88c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 22 Mar 2017 02:20:06 +0100 Subject: vim-patch:8.0.0331 Problem: Restoring help snapshot accesses freed memory. (Dominique Pelle) Solution: Don't restore a snapshot when the window closes. https://github.com/vim/vim/commit/343b8c042967da82f2f022afa31f2c97a264c1c8 --- src/nvim/testdir/test_help.vim | 16 ++++++++++++++++ src/nvim/window.c | 6 ++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 src/nvim/testdir/test_help.vim (limited to 'src') diff --git a/src/nvim/testdir/test_help.vim b/src/nvim/testdir/test_help.vim new file mode 100644 index 0000000000..26edc16107 --- /dev/null +++ b/src/nvim/testdir/test_help.vim @@ -0,0 +1,16 @@ + +" Tests for :help + +func Test_help_restore_snapshot() + help + set buftype= + help + edit x + help + helpclose +endfunc + +func Test_help_errors() + call assert_fails('help doesnotexist', 'E149:') + call assert_fails('help!', 'E478:') +endfunc diff --git a/src/nvim/window.c b/src/nvim/window.c index ebb998e3af..a34daccb89 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5365,10 +5365,8 @@ restore_snapshot ( clear_snapshot(curtab, idx); } -/* - * Check if frames "sn" and "fr" have the same layout, same following frames - * and same children. - */ +/// Check if frames "sn" and "fr" have the same layout, same following frames +/// and same children. And the window pointer is valid. static int check_snapshot_rec(frame_T *sn, frame_T *fr) { if (sn->fr_layout != fr->fr_layout -- cgit