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 <Enter> 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 <Enter> 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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201912251255.xBPCtr3O007938%40masaka.moolenaar.net.

Raspunde prin e-mail lui