From d53086d38dcf11280ecc628a6d6b88109f1553ab Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 23 Apr 2018 16:37:55 +0200 Subject: [PATCH] completion: correctly do a signed comparison, to avoid a segfault Bug existed since commit 30fc197b (a month ago) which changed the type of 'i' from int to size_t, causing the comparison to do the wrong thing when 'threshold' is negative. This fixes https://savannah.gnu.org/bugs/?53722. Reported-by: Devin Hussey --- src/text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text.c b/src/text.c index 9b66e962..e9495abc 100644 --- a/src/text.c +++ b/src/text.c @@ -3614,7 +3614,7 @@ void complete_a_word(void) /* The point where we can stop searching for shard. */ /* Traverse the whole line, looking for shard. */ - for (i = pletion_x; i < threshold; i++) { + for (i = pletion_x; (int)i < threshold; i++) { /* If the first byte doesn't match, run on. */ if (pletion_line->data[i] != shard[0]) continue; -- 2.16.3