]> granicus.if.org Git - vim/commitdiff
Fix: crash in spell checking with a 0x300 character.
authorBram Moolenaar <Bram@vim.org>
Sun, 1 Aug 2010 13:37:02 +0000 (15:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 1 Aug 2010 13:37:02 +0000 (15:37 +0200)
src/spell.c

index eb04c2910d882c020c139b6cf908b8bcfbb6bba7..8ae264df5d0fe82e22469dd0f61422ae7810b357 100644 (file)
@@ -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. */