aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-24 11:20:37 +0800
committerGitHub <noreply@github.com>2025-02-24 11:20:37 +0800
commit01236c3bfeba90a254de75ec720543baf75e6632 (patch)
treec40b5597a05bd2b1a333be2693c4d4b7360a7d07 /src/nvim/ops.c
parent268a3de0a7737155eb5ab1372a9ed76599751847 (diff)
downloadrneovim-01236c3bfeba90a254de75ec720543baf75e6632.tar.gz
rneovim-01236c3bfeba90a254de75ec720543baf75e6632.tar.bz2
rneovim-01236c3bfeba90a254de75ec720543baf75e6632.zip
vim-patch:9.1.1143: illegal memory access when putting a register (#32604)
Problem: illegal memory access when putting a register Solution: make sure cursor column doesn't become negative https://github.com/vim/vim/commit/e0029daa3599529d9d438cc51c7ada8580297a39 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 3e2fa13cdd..72c75534d4 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3623,7 +3623,7 @@ error:
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
- col = (colnr_T)y_array[y_size - 1].size - lendiff;
+ col = MAX(0, (colnr_T)y_array[y_size - 1].size - lendiff);
if (col > 1) {
curbuf->b_op_end.col = col - 1;
if (y_array[y_size - 1].size > 0) {