Karsten Hopp 105127
To: vim-dev@vim.org
Karsten Hopp 105127
Subject: Patch 7.2.332
Karsten Hopp 105127
Fcc: outbox
Karsten Hopp 105127
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 105127
Mime-Version: 1.0
Karsten Hopp 105127
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 105127
Content-Transfer-Encoding: 8bit
Karsten Hopp 105127
------------
Karsten Hopp 105127
Karsten Hopp 105127
Patch 7.2.332
Karsten Hopp 105127
Problem:    Crash when spell correcting triggers an autocommand that reloads
Karsten Hopp 105127
	    the buffer.
Karsten Hopp 105127
Solution:   Make a copy of the line to be modified. (Dominique Pelle)
Karsten Hopp 105127
Files:	    src/spell.c
Karsten Hopp 105127
Karsten Hopp 105127
Karsten Hopp 105127
*** ../vim-7.2.331/src/spell.c	2009-07-22 11:03:38.000000000 +0200
Karsten Hopp 105127
--- src/spell.c	2010-01-19 12:44:42.000000000 +0100
Karsten Hopp 105127
***************
Karsten Hopp 105127
*** 10306,10312 ****
Karsten Hopp 105127
      /* Figure out if the word should be capitalised. */
Karsten Hopp 105127
      need_cap = check_need_cap(curwin->w_cursor.lnum, curwin->w_cursor.col);
Karsten Hopp 105127
  
Karsten Hopp 105127
!     line = ml_get_curline();
Karsten Hopp 105127
  
Karsten Hopp 105127
      /* Get the list of suggestions.  Limit to 'lines' - 2 or the number in
Karsten Hopp 105127
       * 'spellsuggest', whatever is smaller. */
Karsten Hopp 105127
--- 10306,10315 ----
Karsten Hopp 105127
      /* Figure out if the word should be capitalised. */
Karsten Hopp 105127
      need_cap = check_need_cap(curwin->w_cursor.lnum, curwin->w_cursor.col);
Karsten Hopp 105127
  
Karsten Hopp 105127
!     /* Make a copy of current line since autocommands may free the line. */
Karsten Hopp 105127
!     line = vim_strsave(ml_get_curline());
Karsten Hopp 105127
!     if (line == NULL)
Karsten Hopp 105127
! 	goto skip;
Karsten Hopp 105127
  
Karsten Hopp 105127
      /* Get the list of suggestions.  Limit to 'lines' - 2 or the number in
Karsten Hopp 105127
       * 'spellsuggest', whatever is smaller. */
Karsten Hopp 105127
***************
Karsten Hopp 105127
*** 10470,10475 ****
Karsten Hopp 105127
--- 10473,10480 ----
Karsten Hopp 105127
  	curwin->w_cursor = prev_cursor;
Karsten Hopp 105127
  
Karsten Hopp 105127
      spell_find_cleanup(&sug;;
Karsten Hopp 105127
+ skip:
Karsten Hopp 105127
+     vim_free(line);
Karsten Hopp 105127
  }
Karsten Hopp 105127
  
Karsten Hopp 105127
  /*
Karsten Hopp 105127
***************
Karsten Hopp 105127
*** 10931,10937 ****
Karsten Hopp 105127
  	    rescore_suggestions(su);
Karsten Hopp 105127
  
Karsten Hopp 105127
  	/*
Karsten Hopp 105127
! 	 * While going throught the soundfold tree "su_maxscore" is the score
Karsten Hopp 105127
  	 * for the soundfold word, limits the changes that are being tried,
Karsten Hopp 105127
  	 * and "su_sfmaxscore" the rescored score, which is set by
Karsten Hopp 105127
  	 * cleanup_suggestions().
Karsten Hopp 105127
--- 10936,10942 ----
Karsten Hopp 105127
  	    rescore_suggestions(su);
Karsten Hopp 105127
  
Karsten Hopp 105127
  	/*
Karsten Hopp 105127
! 	 * While going through the soundfold tree "su_maxscore" is the score
Karsten Hopp 105127
  	 * for the soundfold word, limits the changes that are being tried,
Karsten Hopp 105127
  	 * and "su_sfmaxscore" the rescored score, which is set by
Karsten Hopp 105127
  	 * cleanup_suggestions().
Karsten Hopp 105127
***************
Karsten Hopp 105127
*** 11415,11421 ****
Karsten Hopp 105127
      char_u	tword[MAXWLEN];	    /* good word collected so far */
Karsten Hopp 105127
      trystate_T	stack[MAXWLEN];
Karsten Hopp 105127
      char_u	preword[MAXWLEN * 3]; /* word found with proper case;
Karsten Hopp 105127
! 				       * concatanation of prefix compound
Karsten Hopp 105127
  				       * words and split word.  NUL terminated
Karsten Hopp 105127
  				       * when going deeper but not when coming
Karsten Hopp 105127
  				       * back. */
Karsten Hopp 105127
--- 11420,11426 ----
Karsten Hopp 105127
      char_u	tword[MAXWLEN];	    /* good word collected so far */
Karsten Hopp 105127
      trystate_T	stack[MAXWLEN];
Karsten Hopp 105127
      char_u	preword[MAXWLEN * 3]; /* word found with proper case;
Karsten Hopp 105127
! 				       * concatenation of prefix compound
Karsten Hopp 105127
  				       * words and split word.  NUL terminated
Karsten Hopp 105127
  				       * when going deeper but not when coming
Karsten Hopp 105127
  				       * back. */
Karsten Hopp 105127
*** ../vim-7.2.331/src/version.c	2010-01-19 12:46:51.000000000 +0100
Karsten Hopp 105127
--- src/version.c	2010-01-19 13:05:32.000000000 +0100
Karsten Hopp 105127
***************
Karsten Hopp 105127
*** 683,684 ****
Karsten Hopp 105127
--- 683,686 ----
Karsten Hopp 105127
  {   /* Add new patch number below this line */
Karsten Hopp 105127
+ /**/
Karsten Hopp 105127
+     332,
Karsten Hopp 105127
  /**/
Karsten Hopp 105127
Karsten Hopp 105127
-- 
Karsten Hopp 105127
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 105127
117. You are more comfortable typing in html.
Karsten Hopp 105127
Karsten Hopp 105127
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 105127
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 105127
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 105127
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///