Karsten Hopp 1948ed
To: vim-dev@vim.org
Karsten Hopp 1948ed
Subject: patch 7.1.051
Karsten Hopp 1948ed
Fcc: outbox
Karsten Hopp 1948ed
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1948ed
Mime-Version: 1.0
Karsten Hopp 1948ed
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 1948ed
Content-Transfer-Encoding: 8bit
Karsten Hopp 1948ed
------------
Karsten Hopp 1948ed
Karsten Hopp 1948ed
Patch 7.1.051
Karsten Hopp 1948ed
Problem:    Accessing uninitialized memory when finding spell suggestions.
Karsten Hopp 1948ed
Solution:   Don't try swapping characters at the end of a word.
Karsten Hopp 1948ed
Files:	    src/spell.c
Karsten Hopp 1948ed
Karsten Hopp 1948ed
Karsten Hopp 1948ed
*** ../vim-7.1.050/src/spell.c	Tue Jul 24 10:44:10 2007
Karsten Hopp 1948ed
--- src/spell.c	Sun Aug  5 16:59:48 2007
Karsten Hopp 1948ed
***************
Karsten Hopp 1948ed
*** 12182,12188 ****
Karsten Hopp 1948ed
  	    {
Karsten Hopp 1948ed
  		n = mb_cptr2len(p);
Karsten Hopp 1948ed
  		c = mb_ptr2char(p);
Karsten Hopp 1948ed
! 		if (!soundfold && !spell_iswordp(p + n, curbuf))
Karsten Hopp 1948ed
  		    c2 = c; /* don't swap non-word char */
Karsten Hopp 1948ed
  		else
Karsten Hopp 1948ed
  		    c2 = mb_ptr2char(p + n);
Karsten Hopp 1948ed
--- 12182,12190 ----
Karsten Hopp 1948ed
  	    {
Karsten Hopp 1948ed
  		n = mb_cptr2len(p);
Karsten Hopp 1948ed
  		c = mb_ptr2char(p);
Karsten Hopp 1948ed
! 		if (p[n] == NUL)
Karsten Hopp 1948ed
! 		    c2 = NUL;
Karsten Hopp 1948ed
! 		else if (!soundfold && !spell_iswordp(p + n, curbuf))
Karsten Hopp 1948ed
  		    c2 = c; /* don't swap non-word char */
Karsten Hopp 1948ed
  		else
Karsten Hopp 1948ed
  		    c2 = mb_ptr2char(p + n);
Karsten Hopp 1948ed
***************
Karsten Hopp 1948ed
*** 12190,12199 ****
Karsten Hopp 1948ed
  	    else
Karsten Hopp 1948ed
  #endif
Karsten Hopp 1948ed
  	    {
Karsten Hopp 1948ed
! 		if (!soundfold && !spell_iswordp(p + 1, curbuf))
Karsten Hopp 1948ed
  		    c2 = c; /* don't swap non-word char */
Karsten Hopp 1948ed
  		else
Karsten Hopp 1948ed
  		    c2 = p[1];
Karsten Hopp 1948ed
  	    }
Karsten Hopp 1948ed
  
Karsten Hopp 1948ed
  	    /* When characters are identical, swap won't do anything.
Karsten Hopp 1948ed
--- 12192,12210 ----
Karsten Hopp 1948ed
  	    else
Karsten Hopp 1948ed
  #endif
Karsten Hopp 1948ed
  	    {
Karsten Hopp 1948ed
! 		if (p[1] == NUL)
Karsten Hopp 1948ed
! 		    c2 = NUL;
Karsten Hopp 1948ed
! 		else if (!soundfold && !spell_iswordp(p + 1, curbuf))
Karsten Hopp 1948ed
  		    c2 = c; /* don't swap non-word char */
Karsten Hopp 1948ed
  		else
Karsten Hopp 1948ed
  		    c2 = p[1];
Karsten Hopp 1948ed
+ 	    }
Karsten Hopp 1948ed
+ 
Karsten Hopp 1948ed
+ 	    /* When the second character is NUL we can't swap. */
Karsten Hopp 1948ed
+ 	    if (c2 == NUL)
Karsten Hopp 1948ed
+ 	    {
Karsten Hopp 1948ed
+ 		sp->ts_state = STATE_REP_INI;
Karsten Hopp 1948ed
+ 		break;
Karsten Hopp 1948ed
  	    }
Karsten Hopp 1948ed
  
Karsten Hopp 1948ed
  	    /* When characters are identical, swap won't do anything.
Karsten Hopp 1948ed
*** ../vim-7.1.050/src/version.c	Sat Aug  4 12:14:04 2007
Karsten Hopp 1948ed
--- src/version.c	Sun Aug  5 18:31:09 2007
Karsten Hopp 1948ed
***************
Karsten Hopp 1948ed
*** 668,669 ****
Karsten Hopp 1948ed
--- 668,671 ----
Karsten Hopp 1948ed
  {   /* Add new patch number below this line */
Karsten Hopp 1948ed
+ /**/
Karsten Hopp 1948ed
+     51,
Karsten Hopp 1948ed
  /**/
Karsten Hopp 1948ed
Karsten Hopp 1948ed
-- 
Karsten Hopp 1948ed
From "know your smileys":
Karsten Hopp 1948ed
 8<}}	Glasses, big nose, beard
Karsten Hopp 1948ed
Karsten Hopp 1948ed
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1948ed
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1948ed
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 1948ed
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///