Yegappan wrote:

> I have crated a PR (#6041) to add new tests for insert mode completion.
> This is currently failing in the Travis/CI ASAN build because of
> a heap buffer overflow with the following test:
> 
> func Test()
>   func! CompleteFunc(findstart, base)
>     if a:findstart == 1
>       return col('.') - 1
>     endif
>     wincmd p
>     return ['a', 'b']
>   endfunc
>   set completefunc=CompleteFunc
>   new
>   call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E839:')
>   close!
> endfunc
> call Test()
> 
> The address sanitizer report is below.
> 
> - Yegappan
> 
> ======================================================
> ==95026==ERROR: AddressSanitizer: heap-buffer-overflow on address
> 0x602000023372 at pc 0x000107438948 bp 0x7ffee91be5f0 sp 0x7ffee91bddb0
> READ of size 1 at 0x602000023372 thread T0
>     #0 0x107438947 in wrap_strlen
> (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x17947)
>     #1 0x106a6a11d in ins_bytes change.c:926
>     #2 0x106c053d3 in ins_compl_insert insexpand.c:3119

Looks like there should be a check here if the offset, returned by
ins_complete_len(), is valid for cp_str.

>     #3 0x106c05b69 in ins_compl_next insexpand.c:3306
>     #4 0x106c073e7 in ins_complete insexpand.c:3954
>     #5 0x106ad969a in edit edit.c:1252
>     #6 0x106c9c515 in invoke_edit normal.c:7080
>     #7 0x106c7d77d in normal_cmd normal.c:1071

[...]

-- 
hundred-and-one symptoms of being an internet addict:
42. Your virtual girlfriend finds a new net sweetheart with a larger bandwidth.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005041846.044IkB8A009164%40masaka.moolenaar.net.

Raspunde prin e-mail lui