Re: vim crash when refer result via systemlist()

2014-04-09 Fir de Conversatie mattn
Ah, sorry I was confused. But this contains a bug. I'll write a patch soon.

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: vim crash when refer result via systemlist()

2014-04-09 Fir de Conversatie mattn
STRCPY/STRNCPY doesn't copy bytes after 0x00.

diff -r dd44a527c2bd src/eval.c
--- a/src/eval.cSun Apr 06 21:34:04 2014 +0200
+++ b/src/eval.cWed Apr 09 19:53:47 2014 +0900
@@ -18319,7 +18319,7 @@
char_u  *s = NULL;
char_u  *start;
char_u  *end;
-   char_u  *p;
+   char_u  *p, *t;
int i;
 
res = get_cmd_output(get_tv_string(argvars[0]), infile,
@@ -18337,13 +18337,13 @@
for (end = start; i  len  *end != NL; ++end)
++i;
 
-   s = vim_strnsave(start, (int)(end - start));
+   s = alloc((unsigned)(end - start + 1));
if (s == NULL)
goto errret;
 
-   for (p = s, end = s + (end - start); p  end; ++p)
-   if (*p == NUL)
-   *p = NL;
+   for (p = s, end = s + (end - start), t = start; p  end; ++p, ++t)
+   *p = *t == NUL ? NL : *t;
+   *p= NUL;
 
li = listitem_alloc();
if (li == NULL)
@@ -18356,6 +18356,7 @@
list_append(list, li);
}
 
+   ++list-lv_refcount;
rettv-v_type = VAR_LIST;
rettv-vval.v_list = list;
list = NULL;

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: vim crash when refer result via systemlist()

2014-04-09 Fir de Conversatie Bram Moolenaar

Yasuhiro Matsumoto wrote:

 systemlist() that added on 7.4.248 make incorrect reference of list.
 
 Below is a patch. Please check and include.

Thanks!


-- 
I started out with nothing, and I still have most of it.
-- Michael Davis -- Tonight Show

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.