To: vim_dev@googlegroups.com Subject: Patch 8.2.0039 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0039 Problem: Memory access error when "z=" has no suggestions. Solution: Check for negative index. Files: src/testdir/test_spell.vim, src/spellsuggest.c *** ../vim-8.2.0038/src/testdir/test_spell.vim 2019-12-25 13:36:32.717113034 +0100 --- src/testdir/test_spell.vim 2019-12-25 13:41:50.788414357 +0100 *************** *** 241,249 **** \ .. "Type number and or click with mouse (empty cancels): ", a) set spell spellsuggest=0 ! " FIXME: the following line is currently commented out as it triggers a ! " memory error detected in cleanup_suggestions() by asan or valgrind. ! "call assert_equal("\nSorry, no suggestions", execute('norm z=')) " Unlike z=, function spellsuggest(...) should not be affected by the " max number of suggestions (2) set by the 'spellsuggest' option. --- 241,247 ---- \ .. "Type number and or click with mouse (empty cancels): ", a) set spell spellsuggest=0 ! call assert_equal("\nSorry, no suggestions", execute('norm z=')) " Unlike z=, function spellsuggest(...) should not be affected by the " max number of suggestions (2) set by the 'spellsuggest' option. *** ../vim-8.2.0038/src/spellsuggest.c 2019-11-02 22:51:27.000000000 +0100 --- src/spellsuggest.c 2019-12-25 13:52:19.642467947 +0100 *************** *** 3729,3735 **** for (i = keep; i < gap->ga_len; ++i) vim_free(stp[i].st_word); gap->ga_len = keep; ! return stp[keep - 1].st_score; } return maxscore; } --- 3729,3736 ---- for (i = keep; i < gap->ga_len; ++i) vim_free(stp[i].st_word); gap->ga_len = keep; ! if (keep >= 1) ! return stp[keep - 1].st_score; } return maxscore; } *** ../vim-8.2.0038/src/version.c 2019-12-25 13:36:32.717113034 +0100 --- src/version.c 2019-12-25 13:42:33.236301026 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 39, /**/ -- This is the polymorph virus! Follow these instructions carefully: 1. Send this message to everybody you know. 2. Format your harddisk. Thank you for your cooperation in spreading the most powerful virus ever! /// 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 ///