Blame SOURCES/7.4.102

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.102
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.102
22c937
Problem:    Crash when interrupting "z=".
22c937
Solution:   Add safety check for word length. (Christian Brabandt, Dominique
22c937
	    Pelle)
22c937
Files:	    src/spell.c
22c937
22c937
22c937
*** ../vim-7.4.101/src/spell.c	2013-11-14 03:54:02.000000000 +0100
22c937
--- src/spell.c	2013-11-21 17:37:04.000000000 +0100
22c937
***************
22c937
*** 13398,13406 ****
22c937
  
22c937
  	/* Lookup the word "orgnr" one of the two tries. */
22c937
  	n = 0;
22c937
- 	wlen = 0;
22c937
  	wordcount = 0;
22c937
! 	for (;;)
22c937
  	{
22c937
  	    i = 1;
22c937
  	    if (wordcount == orgnr && byts[n + 1] == NUL)
22c937
--- 13398,13405 ----
22c937
  
22c937
  	/* Lookup the word "orgnr" one of the two tries. */
22c937
  	n = 0;
22c937
  	wordcount = 0;
22c937
! 	for (wlen = 0; wlen < MAXWLEN - 3; ++wlen)
22c937
  	{
22c937
  	    i = 1;
22c937
  	    if (wordcount == orgnr && byts[n + 1] == NUL)
22c937
***************
22c937
*** 13414,13419 ****
22c937
--- 13413,13419 ----
22c937
  		if (i > byts[n])	/* safety check */
22c937
  		{
22c937
  		    STRCPY(theword + wlen, "BAD");
22c937
+ 		    wlen += 3;
22c937
  		    goto badword;
22c937
  		}
22c937
  
22c937
***************
22c937
*** 13426,13432 ****
22c937
  		wordcount += wc;
22c937
  	    }
22c937
  
22c937
! 	    theword[wlen++] = byts[n + i];
22c937
  	    n = idxs[n + i];
22c937
  	}
22c937
  badword:
22c937
--- 13426,13432 ----
22c937
  		wordcount += wc;
22c937
  	    }
22c937
  
22c937
! 	    theword[wlen] = byts[n + i];
22c937
  	    n = idxs[n + i];
22c937
  	}
22c937
  badword:
22c937
*** ../vim-7.4.101/src/version.c	2013-11-21 17:12:55.000000000 +0100
22c937
--- src/version.c	2013-11-21 17:38:21.000000000 +0100
22c937
***************
22c937
*** 740,741 ****
22c937
--- 740,743 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     102,
22c937
  /**/
22c937
22c937
-- 
22c937
Engineers will go without food and hygiene for days to solve a problem.
22c937
(Other times just because they forgot.)
22c937
				(Scott Adams - The Dilbert principle)
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///