diff src/spellsuggest.c @ 29208:b8dc0a76911e v8.2.5123

patch 8.2.5123: using invalid index when looking for spell suggestions Commit: https://github.com/vim/vim/commit/156d3911952d73b03d7420dc3540215247db0fe8 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 18 14:09:08 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 18 Jun 2022 15:15:04 +0200
parents 77cd4bf3ad7d
children 6d93f09815c1
line wrap: on
line diff
--- a/src/spellsuggest.c
+++ b/src/spellsuggest.c
@@ -1973,7 +1973,8 @@ suggest_trie_walk(
 			    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;