diff --git a/7.1.051 b/7.1.051 new file mode 100644 index 0000000..bee1c1e --- /dev/null +++ b/7.1.051 @@ -0,0 +1,86 @@ +To: vim-dev@vim.org +Subject: patch 7.1.051 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.1.051 +Problem: Accessing uninitialized memory when finding spell suggestions. +Solution: Don't try swapping characters at the end of a word. +Files: src/spell.c + + +*** ../vim-7.1.050/src/spell.c Tue Jul 24 10:44:10 2007 +--- src/spell.c Sun Aug 5 16:59:48 2007 +*************** +*** 12182,12188 **** + { + n = mb_cptr2len(p); + c = mb_ptr2char(p); +! if (!soundfold && !spell_iswordp(p + n, curbuf)) + c2 = c; /* don't swap non-word char */ + else + c2 = mb_ptr2char(p + n); +--- 12182,12190 ---- + { + n = mb_cptr2len(p); + c = mb_ptr2char(p); +! if (p[n] == NUL) +! c2 = NUL; +! else if (!soundfold && !spell_iswordp(p + n, curbuf)) + c2 = c; /* don't swap non-word char */ + else + c2 = mb_ptr2char(p + n); +*************** +*** 12190,12199 **** + else + #endif + { +! if (!soundfold && !spell_iswordp(p + 1, curbuf)) + c2 = c; /* don't swap non-word char */ + else + c2 = p[1]; + } + + /* When characters are identical, swap won't do anything. +--- 12192,12210 ---- + else + #endif + { +! if (p[1] == NUL) +! c2 = NUL; +! else if (!soundfold && !spell_iswordp(p + 1, curbuf)) + c2 = c; /* don't swap non-word char */ + else + c2 = p[1]; ++ } ++ ++ /* When the second character is NUL we can't swap. */ ++ if (c2 == NUL) ++ { ++ sp->ts_state = STATE_REP_INI; ++ break; + } + + /* When characters are identical, swap won't do anything. +*** ../vim-7.1.050/src/version.c Sat Aug 4 12:14:04 2007 +--- src/version.c Sun Aug 5 18:31:09 2007 +*************** +*** 668,669 **** +--- 668,671 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 51, + /**/ + +-- +From "know your smileys": + 8<}} Glasses, big nose, beard + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ download, build and distribute -- http://www.A-A-P.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org ///