Patch 9.0.0052
Problem:    "zG" may throw an error if invalid character follows.
Solution:   Pass the word length to valid_spell_word(). (Ken Takata,
            closes #10737)
Files:      src/spellfile.c, src/testdir/test_spell.vim


*** ../vim-9.0.0051/src/spellfile.c     2022-07-01 22:26:16.691721005 +0100
--- src/spellfile.c     2022-07-14 17:21:02.116494665 +0100
***************
*** 4371,4383 ****
   * Control characters and trailing '/' are invalid.  Space is OK.
   */
      static int
! valid_spell_word(char_u *word)
  {
      char_u *p;
  
!     if (enc_utf8 && !utf_valid_string(word, NULL))
        return FALSE;
!     for (p = word; *p != NUL; p += mb_ptr2len(p))
        if (*p < ' ' || (p[0] == '/' && p[1] == NUL))
            return FALSE;
      return TRUE;
--- 4371,4383 ----
   * Control characters and trailing '/' are invalid.  Space is OK.
   */
      static int
! valid_spell_word(char_u *word, char_u *end)
  {
      char_u *p;
  
!     if (enc_utf8 && !utf_valid_string(word, end))
        return FALSE;
!     for (p = word; *p != NUL && p < end; p += mb_ptr2len(p))
        if (*p < ' ' || (p[0] == '/' && p[1] == NUL))
            return FALSE;
      return TRUE;
***************
*** 4408,4414 ****
      char_u    *p;
  
      // Avoid adding illegal bytes to the word tree.
!     if (!valid_spell_word(word))
        return FAIL;
  
      (void)spell_casefold(curwin, word, len, foldword, MAXWLEN);
--- 4408,4414 ----
      char_u    *p;
  
      // Avoid adding illegal bytes to the word tree.
!     if (!valid_spell_word(word, word + len))
        return FAIL;
  
      (void)spell_casefold(curwin, word, len, foldword, MAXWLEN);
***************
*** 6211,6217 ****
      int               i;
      char_u    *spf;
  
!     if (!valid_spell_word(word))
      {
        emsg(_(e_illegal_character_in_word));
        return;
--- 6211,6217 ----
      int               i;
      char_u    *spf;
  
!     if (!valid_spell_word(word, word + len))
      {
        emsg(_(e_illegal_character_in_word));
        return;
*** ../vim-9.0.0051/src/testdir/test_spell.vim  2022-07-04 13:37:03.937167269 
+0100
--- src/testdir/test_spell.vim  2022-07-14 17:21:02.120494681 +0100
***************
*** 884,889 ****
--- 884,899 ----
    bwipe!
  endfunc
  
+ func Test_spell_good_word_slash()
+   " This caused E1280.
+   new
+   norm afoo /
+   1
+   norm zG
+ 
+   bwipe!
+ endfunc
+ 
  func LoadAffAndDic(aff_contents, dic_contents)
    set enc=latin1
    set spellfile=
*** ../vim-9.0.0051/src/version.c       2022-07-14 17:06:06.660997005 +0100
--- src/version.c       2022-07-14 17:23:48.757049200 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     52,
  /**/

-- 
>From "know your smileys":
 :-X    My lips are sealed

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220714162617.507191C0541%40moolenaar.net.

Raspunde prin e-mail lui