summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-08-01 15:37:02 +0200
committerBram Moolenaar <Bram@vim.org>2010-08-01 15:37:02 +0200
commit95e8579e1c5b98b626a8d6a8c1ebafb8ead26a1e (patch)
treebb5226b03e96e5b6627a0a9132fcde83d8b04cb1
parent121d95f7d181a65807c787039147e8f7d76e5a87 (diff)
downloadvim-95e8579e1c5b98b626a8d6a8c1ebafb8ead26a1e.zip
Fix: crash in spell checking with a 0x300 character.
-rw-r--r--src/spell.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/spell.c b/src/spell.c
index eb04c2910..8ae264df5 100644
--- 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. */