emojicompletion: Avoid a memory overrun

Don't read beyond the beginning of the string.

Fixes: #3245
This commit is contained in:
Matthias Clasen 2020-10-15 15:16:06 -04:00
parent 0bd5a96d71
commit 4e04c39609

View File

@ -115,7 +115,8 @@ next:
break; break;
} }
} }
while (g_unichar_isalnum (g_utf8_get_char (p)) || *p == '_' || *p == ' '); while (p > text &&
(g_unichar_isalnum (g_utf8_get_char (p)) || *p == '_' || *p == ' '));
if (found_candidate) if (found_candidate)
n_matches = populate_completion (completion, p, 0); n_matches = populate_completion (completion, p, 0);