To: vim_dev@googlegroups.com Subject: Patch 8.0.1413 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1413 Problem: Accessing freed memory in :cbuffer. Solution: Get quickfix list after executing autocmds. (closes #2470) Files: src/quickfix.c, src/testdir/test_autocmd.vim *** ../vim-8.0.1412/src/quickfix.c 2017-12-19 12:38:47.446798184 +0100 --- src/quickfix.c 2017-12-19 16:20:35.721283442 +0100 *************** *** 5520,5533 **** #endif int res; - if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer - || eap->cmdidx == CMD_laddbuffer) - { - qi = ll_get_or_alloc_list(curwin); - if (qi == NULL) - return; - } - #ifdef FEAT_AUTOCMD switch (eap->cmdidx) { --- 5520,5525 ---- *************** *** 5549,5554 **** --- 5541,5555 ---- } #endif + /* Must come after autocommands. */ + if (eap->cmdidx == CMD_lbuffer || eap->cmdidx == CMD_lgetbuffer + || eap->cmdidx == CMD_laddbuffer) + { + qi = ll_get_or_alloc_list(curwin); + if (qi == NULL) + return; + } + if (*eap->arg == NUL) buf = curbuf; else if (*skipwhite(skipdigits(eap->arg)) == NUL) *** ../vim-8.0.1412/src/testdir/test_autocmd.vim 2017-12-18 15:32:55.274906330 +0100 --- src/testdir/test_autocmd.vim 2017-12-19 16:14:09.003712418 +0100 *************** *** 1178,1180 **** --- 1178,1187 ---- call assert_fails('lvĀ½ /x', 'E480') au! endfunc + + func Test_wipe_cbuffer() + sv x + au * * bw + lb + au! + endfunc *** ../vim-8.0.1412/src/version.c 2017-12-19 12:38:47.446798184 +0100 --- src/version.c 2017-12-19 16:22:14.032659838 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1413, /**/ -- Why is it called "Windows"? "Gates" would be more appropriate... /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///