changeset 2455:9367de3e2e1b vim73

Fix: crash in spell checking with a 0x300 character.
author Bram Moolenaar <bram@vim.org>
date Sun, 01 Aug 2010 15:37:02 +0200
parents 91fec91a522c
children 2876ac15b8c8
files src/spell.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/spell.c
+++ b/src/spell.c
@@ -14493,8 +14493,11 @@ spell_soundfold_wsal(slang, inword, res)
 
 	if (n >= 0)
 	{
-	    /* check all rules for the same index byte */
-	    for (; ((ws = smp[n].sm_lead_w)[0] & 0xff) == (c & 0xff); ++n)
+	    /* Check all rules for the same index byte.
+	     * If c is 0x300 need extra check for the end of the array, as
+	     * (c & 0xff) is NUL. */
+	    for (; ((ws = smp[n].sm_lead_w)[0] & 0xff) == (c & 0xff)
+							 && ws[0] != NUL; ++n)
 	    {
 		/* Quickly skip entries that don't match the word.  Most
 		 * entries are less then three chars, optimize for that. */