mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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 vim/vim#8965)
e275ba4fc9
This commit is contained in:
parent
516d6318b7
commit
bafb53604a
@ -3663,6 +3663,12 @@ static void suggest_try_change(suginfo_T *su)
|
|||||||
p = su->su_badptr + su->su_badlen;
|
p = su->su_badptr + su->su_badlen;
|
||||||
(void)spell_casefold(curwin, p, (int)STRLEN(p), fword + n, MAXWLEN - n);
|
(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 (int lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
for (int lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
||||||
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
|
|
||||||
|
@ -768,6 +768,21 @@ func Test_spellfile_value()
|
|||||||
set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
|
set spellfile=Xdir/Xtest.utf-8.add,Xtest_other.add
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_no_crash_with_weird_text()
|
||||||
|
new
|
||||||
|
let lines =<< trim END
|
||||||
|
r<sfile>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
|
call setline(1, lines)
|
||||||
|
exe "%norm \<C-v>ez=>\<C-v>wzG"
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Invalid bytes may cause trouble when creating the word list.
|
" Invalid bytes may cause trouble when creating the word list.
|
||||||
func Test_check_for_valid_word()
|
func Test_check_for_valid_word()
|
||||||
call assert_fails("spellgood! 0\xac", 'E1280:')
|
call assert_fails("spellgood! 0\xac", 'E1280:')
|
||||||
|
Loading…
Reference in New Issue
Block a user