mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
vim-patch:8.2.0039: memory access error when "z=" has no suggestions
Problem: Memory access error when "z=" has no suggestions.
Solution: Check for negative index.
569fea2c31
This commit is contained in:
@@ -5761,7 +5761,9 @@ cleanup_suggestions (
|
|||||||
xfree(stp[i].st_word);
|
xfree(stp[i].st_word);
|
||||||
}
|
}
|
||||||
gap->ga_len = keep;
|
gap->ga_len = keep;
|
||||||
return stp[keep - 1].st_score;
|
if (keep >= 1) {
|
||||||
|
return stp[keep - 1].st_score;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return maxscore;
|
return maxscore;
|
||||||
|
@@ -285,9 +285,7 @@ func Test_spellsuggest_option_number()
|
|||||||
\ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
|
\ .. "Type number and <Enter> or click with the mouse (q or empty cancels): ", a)
|
||||||
|
|
||||||
set spell spellsuggest=0
|
set spell spellsuggest=0
|
||||||
" FIXME: the following line is currently commented out as it triggers a
|
call assert_equal("\nSorry, no suggestions", execute('norm z='))
|
||||||
" memory error detected in cleanup_suggestions() by asan or valgrind.
|
|
||||||
"call assert_equal("\nSorry, no suggestions", execute('norm z='))
|
|
||||||
|
|
||||||
" Unlike z=, function spellsuggest(...) should not be affected by the
|
" Unlike z=, function spellsuggest(...) should not be affected by the
|
||||||
" max number of suggestions (2) set by the 'spellsuggest' option.
|
" max number of suggestions (2) set by the 'spellsuggest' option.
|
||||||
|
Reference in New Issue
Block a user