mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +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#17552
93318a9933
This commit is contained in:
@@ -1799,7 +1799,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