vim-patch:8.0.1223: crash when using autocomplete and tab pages

Problem:    Crash when using autocomplete and tab pages.
Solution:   Check if the current tab changed. (Christian Brabandt, closes
            vim/vim#2239)

9ad89c6c4f
This commit is contained in:
Justin M. Keyes
2018-02-11 14:09:45 +01:00
parent abed6a0b1a
commit d285d6ca0d
3 changed files with 49 additions and 3 deletions

View File

@@ -1469,7 +1469,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
}
}
char_u *newp = (char_u *) xmalloc((size_t)(linelen + newlen - oldlen));
char_u *newp = xmalloc((size_t)(linelen + newlen - oldlen));
// Copy bytes before the cursor.
if (col > 0) {
@@ -1478,7 +1478,10 @@ void ins_char_bytes(char_u *buf, size_t charlen)
// Copy bytes after the changed character(s).
char_u *p = newp + col;
memmove(p + newlen, oldp + col + oldlen, (size_t)(linelen - col - oldlen));
if (linelen > col + oldlen) {
memmove(p + newlen, oldp + col + oldlen,
(size_t)(linelen - col - oldlen));
}
// Insert or overwrite the new character.
memmove(p, buf, charlen);