0
0
mirror of https://github.com/vim/vim.git synced 2025-11-14 23:04:02 -05:00

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)
This commit is contained in:
Bram Moolenaar
2021-10-06 13:41:07 +01:00
parent e2982d6911
commit e275ba4fc9
4 changed files with 25 additions and 1 deletions

View File

@@ -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);