patch 8.2.3582: reading uninitialized memory when giving spell suggestions
Problem: Reading uninitialized memory when giving spell suggestions.
Solution: Check that preword is not empty.
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index a6dbc78..255f94d 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -1619,7 +1619,7 @@
// char, e.g., "thes," -> "these".
p = fword + sp->ts_fidx;
MB_PTR_BACK(fword, p);
- if (!spell_iswordp(p, curwin))
+ if (!spell_iswordp(p, curwin) && *preword != NUL)
{
p = preword + STRLEN(preword);
MB_PTR_BACK(preword, p);