mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 09:31:47 +00:00
vim-patch:9.1.1609: complete: Heap-buffer overflow with complete function
Problem: complete: Heap-buffer overflow with complete function
(zeertzjq)
Solution: Do not let startcol become negative (Girish Palya).
fixes: vim/vim#17907
closes: vim/vim#17934
761ea77670
Co-authored-by: Girish Palya <girishji@gmail.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
This commit is contained in:
@@ -5524,4 +5524,32 @@ func Test_scriplocal_autoload_func()
|
||||
let &rtp = save_rtp
|
||||
endfunc
|
||||
|
||||
" Issue #17907
|
||||
func Test_omni_start_invalid_col()
|
||||
func OmniFunc(startcol, findstart, base)
|
||||
if a:findstart
|
||||
return a:startcol
|
||||
else
|
||||
return ['foo', 'foobar']
|
||||
endif
|
||||
endfunc
|
||||
|
||||
new
|
||||
redraw " need this to prevent NULL dereference in Nvim
|
||||
set complete=o
|
||||
set omnifunc=funcref('OmniFunc',\ [-1])
|
||||
call setline(1, ['baz '])
|
||||
call feedkeys("A\<C-N>\<Esc>0", 'tx!')
|
||||
call assert_equal('baz foo', getline(1))
|
||||
|
||||
set omnifunc=funcref('OmniFunc',\ [1000])
|
||||
call setline(1, ['bar '])
|
||||
call feedkeys("A\<C-N>\<Esc>0", 'tx!')
|
||||
call assert_equal('bar foo', getline(1))
|
||||
bw!
|
||||
|
||||
delfunc OmniFunc
|
||||
set omnifunc& complete&
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
||||
|
||||
Reference in New Issue
Block a user