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

e0029daa35

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-02-24 11:20:37 +08:00
committed by GitHub
parent 268a3de0a7
commit 01236c3bfe
3 changed files with 43 additions and 1 deletions

View File

@@ -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) {