To: vim_dev@googlegroups.com Subject: Patch 8.0.0084 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0084 Problem: Using freed memory when adding to a quickfix list. (Domenique Pelle) Solution: Clear the directory name. Files: src/quicfix.c, src/testdir/test_quickfix.vim *** ../vim-8.0.0083/src/quickfix.c 2016-11-12 18:14:39.605896756 +0100 --- src/quickfix.c 2016-11-13 15:02:08.327755407 +0100 *************** *** 1617,1623 **** static bufref_T qf_last_bufref = {NULL, 0}; /* ! * Get buffer number for file "directory.fname". * Also sets the b_has_qf_entry flag. */ static int --- 1617,1623 ---- static bufref_T qf_last_bufref = {NULL, 0}; /* ! * Get buffer number for file "directory/fname". * Also sets the b_has_qf_entry flag. */ static int *************** *** 2711,2717 **** --- 2711,2719 ---- qi->qf_lists[idx].qf_index = 0; qf_clean_dir_stack(&qi->qf_dir_stack); + qi->qf_directory = NULL; qf_clean_dir_stack(&qi->qf_file_stack); + qi->qf_currfile = NULL; } /* *** ../vim-8.0.0083/src/testdir/test_quickfix.vim 2016-11-12 18:14:39.609896729 +0100 --- src/testdir/test_quickfix.vim 2016-11-13 14:52:16.099512635 +0100 *************** *** 1669,1671 **** --- 1669,1693 ---- call assert_fails('caddexpr ""', 'E376:') let &efm = save_efm endfunc + + func Test_dirstack_cleanup() + " This used to cause a memory access in freed memory. + let save_efm = &efm + lexpr '0' + lopen + fun X(c) + let save_efm=&efm + set efm=%D%f + if a:c == 'c' + caddexpr '::' + else + laddexpr ':0:0' + endif + let &efm=save_efm + endfun + call X('c') + call X('l') + call setqflist([], 'r') + caddbuffer + let &efm = save_efm + endfunc *** ../vim-8.0.0083/src/version.c 2016-11-13 14:31:36.691499383 +0100 --- src/version.c 2016-11-13 15:08:25.177362299 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 84, /**/ -- Far back in the mists of ancient time, in the great and glorious days of the former Galactic Empire, life was wild, rich and largely tax free. Mighty starships plied their way between exotic suns, seeking adventure and reward among the furthest reaches of Galactic space. In those days, spirits were brave, the stakes were high, men were real men, women were real women and small furry creatures from Alpha Centauri were real small furry creatures from Alpha Centauri. And all dared to brave unknown terrors, to do mighty deeds, to boldly split infinitives that no man had split before -- and thus was the Empire forged. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// 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 ///