Mercurial > vim
diff src/spellsuggest.c @ 25901:f48c435bd1df v8.2.3484
patch 8.2.3484: crash when going through spell suggestions
Commit: https://github.com/vim/vim/commit/e275ba4fc994474155fbafe8b87a6d3b477456ba
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 6 13:41:07 2021 +0100
patch 8.2.3484: crash when going through spell suggestions
Problem: Crash when going through spell suggestions.
Solution: Limit the text length for finding suggestions to the original
length. Do not update buffers when exiting. (closes #8965)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 06 Oct 2021 14:45:03 +0200 |
parents | 59cfa23bd9eb |
children | 25b93e560a7c |
line wrap: on
line diff
--- a/src/spellsuggest.c +++ b/src/spellsuggest.c @@ -1178,6 +1178,11 @@ suggest_try_change(suginfo_T *su) p = su->su_badptr + su->su_badlen; (void)spell_casefold(curwin, p, (int)STRLEN(p), fword + n, MAXWLEN - n); + // Make sure the resulting text is not longer than the original text. + n = (int)STRLEN(su->su_badptr); + if (n < MAXWLEN) + fword[n] = NUL; + for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) { lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);