patch 8.2.5123: using invalid index when looking for spell suggestions
Problem: Using invalid index when looking for spell suggestions.
Solution: Do not decrement the index when it is zero.
diff --git a/src/spellsuggest.c b/src/spellsuggest.c
index 5b460a3..8f97565 100644
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -1973,7 +1973,8 @@
sp->ts_isdiff = (newscore != 0)
? DIFF_YES : DIFF_NONE;
}
- else if (sp->ts_isdiff == DIFF_INSERT)
+ else if (sp->ts_isdiff == DIFF_INSERT
+ && sp->ts_fidx > 0)
// When inserting trail bytes don't advance in the
// bad word.
--sp->ts_fidx;