diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-05-26 07:20:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-26 07:20:39 +0800 |
commit | cbf57fa353e54e01ae405565caddf3725a2814ba (patch) | |
tree | 4784b7a088aa3bd9b2111fcd3a2187b977f68cbf /src/nvim/ops.c | |
parent | 9fec6dc9a25b5cf9c9a444ac2bd0728e8af3229e (diff) | |
download | rneovim-cbf57fa353e54e01ae405565caddf3725a2814ba.tar.gz rneovim-cbf57fa353e54e01ae405565caddf3725a2814ba.tar.bz2 rneovim-cbf57fa353e54e01ae405565caddf3725a2814ba.zip |
vim-patch:8.2.5016: access before start of text with a put command (#18742)
Problem: Access before start of text with a put command.
Solution: Check the length is more than zero.
https://github.com/vim/vim/commit/2a585c85013be22f59f184d49612074fd9b115d7
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r-- | src/nvim/ops.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 83e2a85112..6e6f478166 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3696,8 +3696,11 @@ error: len = STRLEN(y_array[y_size - 1]); col = (colnr_T)len - lendiff; if (col > 1) { - curbuf->b_op_end.col = col - 1 - utf_head_off(y_array[y_size - 1], - y_array[y_size - 1] + len - 1); + curbuf->b_op_end.col = col - 1; + if (len > 0) { + curbuf->b_op_end.col -= utf_head_off(y_array[y_size - 1], + y_array[y_size - 1] + len - 1); + } } else { curbuf->b_op_end.col = 0; } |