diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 14:09:45 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 19:03:27 +0100 |
commit | d285d6ca0dc5123b5111239140751f4d986ee15c (patch) | |
tree | dc3328cd439b76ecb4fc9ed791935c152f723b61 /src/nvim/misc1.c | |
parent | abed6a0b1a71e54b143e98678f4daa6818b02f8d (diff) | |
download | rneovim-d285d6ca0dc5123b5111239140751f4d986ee15c.tar.gz rneovim-d285d6ca0dc5123b5111239140751f4d986ee15c.tar.bz2 rneovim-d285d6ca0dc5123b5111239140751f4d986ee15c.zip |
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)
https://github.com/vim/vim/commit/9ad89c6c4f89cd710d8244d8010b8b0ae30ba79d
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 8bd59b5886..b0232b6516 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -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); |