From caa33aaaf8b044cf3a8311213d0841d2d9e591a5 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 12 Nov 2016 14:18:29 -0500 Subject: vim-patch:7.4.1647 Problem: Using freed memory after setqflist() and ":caddbuffer". (Dominique) Solution: Set qf_ptr when adding the first item to the quickfix list. https://github.com/vim/vim/commit/8b20179c657b4266dff115486ca68c6a50324071 --- test/functional/legacy/quickfix_spec.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua index 480e046f55..fa9ddc78ae 100644 --- a/test/functional/legacy/quickfix_spec.lua +++ b/test/functional/legacy/quickfix_spec.lua @@ -443,6 +443,17 @@ describe('helpgrep', function() augroup! testgroup endfunc + + func Test_caddbuffer_to_empty() + helpgr quickfix + call setqflist([], 'r') + cad + call assert_fails('cn', 'E553:') + " Upstream calls quit! here to verify vim is still + " running, but that will be covered by the + " expected_empty() call in the busted test + " quit! + endfunc ]]) end) @@ -522,6 +533,11 @@ describe('helpgrep', function() call('XquickfixChangedByAutocmd', 'l') expected_empty() end) + + it('does not crash after using caddbuffer with an empty qf list', function() + call('Test_caddbuffer_to_empty') + expected_empty() + end) end) describe('errorformat', function() -- cgit