0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 7.4.704

Problem:    Searching for a character matches an illegal byte and causes
            invalid memory access. (Dominique Pelle)
Solution:   Do not match an invalid byte when search for a character in a
            string.  Fix equivalence classes using negative numbers, which
            result in illegal bytes.
This commit is contained in:
Bram Moolenaar
2015-04-21 14:02:35 +02:00
parent f9bde2b152
commit d82a2a990b
4 changed files with 74 additions and 60 deletions

View File

@@ -1885,9 +1885,12 @@ vim_strchr(string, c)
{
while (*p != NUL)
{
if (utf_ptr2char(p) == c)
int l = (*mb_ptr2len)(p);
/* Avoid matching an illegal byte here. */
if (utf_ptr2char(p) == c && l > 1)
return p;
p += (*mb_ptr2len)(p);
p += l;
}
return NULL;
}