Vim crashes when loading autoload function is interrupted with CTRL-C.
Steps to reproduce:
$ cat test.vim
" allocate globvarht.hi_array.
for i in range(1000)
let g:["x_" . i] = i
endfor
echo "Press CTRL-C after waiting several seconds"
call xxx#yyy#zzz()
$ cat test/autoload/xxx/yyy.vim
" eat memory...
let i = 0
while 1
let g:["x_" . i] = repeat('x', i)
let i += 1
endwhile
$ vim -u NONE -N --cmd "set runtimepath+=$PWD/test"
:source test.vim
Then, press CTRL-C after waiting several seconds.
The following patch fixes this problem. Please check it.
hi may become invalid pointer while processing autoload script.
diff -r 37ecb8ff4560 src/eval.c
--- a/src/eval.c Thu Oct 20 22:22:38 2011 +0200
+++ b/src/eval.c Thu Oct 27 20:49:16 2011 +0900
@@ -19589,9 +19589,12 @@
* worked find the variable again. Don't auto-load a script if it was
* loaded already, otherwise it would be loaded every time when
* checking if a function name is a Funcref variable. */
- if (ht == &globvarht && !writing
- && script_autoload(varname, FALSE) && !aborting())
+ if (ht == &globvarht && !writing)
+ {
+ if (!script_autoload(varname, FALSE) || aborting())
+ return NULL;
hi = hash_find(ht, varname);
+ }
if (HASHITEM_EMPTY(hi))
return NULL;
}
--
Yukihiro Nakadaira - [email protected]
--
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