comparison 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
comparison
equal deleted inserted replaced
25900:b55afbf97a65 25901:f48c435bd1df
1175 // chars after the bad word may help. 1175 // chars after the bad word may help.
1176 STRCPY(fword, su->su_fbadword); 1176 STRCPY(fword, su->su_fbadword);
1177 n = (int)STRLEN(fword); 1177 n = (int)STRLEN(fword);
1178 p = su->su_badptr + su->su_badlen; 1178 p = su->su_badptr + su->su_badlen;
1179 (void)spell_casefold(curwin, p, (int)STRLEN(p), fword + n, MAXWLEN - n); 1179 (void)spell_casefold(curwin, p, (int)STRLEN(p), fword + n, MAXWLEN - n);
1180
1181 // Make sure the resulting text is not longer than the original text.
1182 n = (int)STRLEN(su->su_badptr);
1183 if (n < MAXWLEN)
1184 fword[n] = NUL;
1180 1185
1181 for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) 1186 for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi)
1182 { 1187 {
1183 lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi); 1188 lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
1184 1189