Andy Wokula wrote:

> Crash when a:curpos (0-based) accesses an invalid string index
> in a:cmdline:
>
>
> func! CrashComplete(arglead, cmdline, curpos)
>    " return ["ok"]
>    return [a:cmdline[a:curpos]]
> endfunc
>
> com! -nargs=* -complete=customlist,CrashComplete Testcmd echo <q-args>
>
> " to reproduce:
> :Testcmd <Tab>

I can reproduce it with Vim-7.2.197 on Linux x86.

Attached patch fixes it I think.

Cheers
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: ex_getln.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/ex_getln.c,v
retrieving revision 1.103
diff -c -r1.103 ex_getln.c
*** ex_getln.c	16 May 2009 15:30:54 -0000	1.103
--- ex_getln.c	13 Jun 2009 13:45:14 -0000
***************
*** 4874,4880 ****
      /* Loop over the items in the list. */
      for (li = retlist->lv_first; li != NULL; li = li->li_next)
      {
! 	if (li->li_tv.v_type != VAR_STRING)
  	    continue;  /* Skip non-string items */
  
  	if (ga_grow(&ga, 1) == FAIL)
--- 4874,4880 ----
      /* Loop over the items in the list. */
      for (li = retlist->lv_first; li != NULL; li = li->li_next)
      {
! 	if (li->li_tv.v_type != VAR_STRING || li->li_tv.vval.v_string == NULL)
  	    continue;  /* Skip non-string items */
  
  	if (ga_grow(&ga, 1) == FAIL)

Raspunde prin e-mail lui