aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-13 06:17:50 +0800
committerGitHub <noreply@github.com>2023-12-13 06:17:50 +0800
commitd65c6a0bafada059e87a11a4bcd129afc16d2e5d (patch)
treeb7b61f1bab5645e344a37daae36fafe198ebc92e /src
parent69ffbb76c237fcbba24de80f1b5346d92642e800 (diff)
downloadrneovim-d65c6a0bafada059e87a11a4bcd129afc16d2e5d.tar.gz
rneovim-d65c6a0bafada059e87a11a4bcd129afc16d2e5d.tar.bz2
rneovim-d65c6a0bafada059e87a11a4bcd129afc16d2e5d.zip
vim-patch:9.0.2159: screenpos() may crash with neg. column (#26542)
Problem: screenpos() may crash with neg. column Solution: validate and correct column closes: vim/vim#13669 https://github.com/vim/vim/commit/ec54af4e26952d954a4cc009f62c80ea01445d30
Diffstat (limited to 'src')
-rw-r--r--src/nvim/move.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 12fb7d1f82..bbc3d792c0 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -1125,6 +1125,9 @@ void f_screenpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
semsg(_(e_invalid_line_number_nr), pos.lnum);
return;
}
+ if (pos.col < 0) {
+ pos.col = 0;
+ }
int row = 0;
int scol = 0, ccol = 0, ecol = 0;
textpos2screenpos(wp, &pos, &row, &scol, &ccol, &ecol, false);