mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
vim-patch:9.1.1463: Integer overflow in getmarklist() after linewise operation (#34532)
Problem: Integer overflow in getmarklist() after linewise operation. Solution: Don't add 1 to MAXCOL (zeertzjq) related: neovim/neovim#34524 closes: vim/vim#1755293318a9933
(cherry picked from commit3e984cf02b
)
This commit is contained in:
committed by
github-actions[bot]
parent
1077374380
commit
9ffa94b07b
@ -1796,7 +1796,7 @@ static int add_mark(list_T *l, const char *mname, const pos_T *pos, int bufnr, c
|
||||
|
||||
tv_list_append_number(lpos, bufnr);
|
||||
tv_list_append_number(lpos, pos->lnum);
|
||||
tv_list_append_number(lpos, pos->col + 1);
|
||||
tv_list_append_number(lpos, pos->col < MAXCOL ? pos->col + 1 : MAXCOL);
|
||||
tv_list_append_number(lpos, pos->coladd);
|
||||
|
||||
if (tv_dict_add_str(d, S_LEN("mark"), mname) == FAIL
|
||||
|
@ -301,6 +301,11 @@ func Test_getmarklist()
|
||||
call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 2, 0]},
|
||||
\ bufnr()->getmarklist()[0])
|
||||
call assert_equal([], {}->getmarklist())
|
||||
normal! yy
|
||||
call assert_equal([
|
||||
\ {'mark': "'[", 'pos': [bufnr(), 2, 1, 0]},
|
||||
\ {'mark': "']", 'pos': [bufnr(), 2, v:maxcol, 0]},
|
||||
\ ], getmarklist(bufnr())[-2:])
|
||||
close!
|
||||
endfunc
|
||||
|
||||
|
Reference in New Issue
Block a user