1
0
forked from aniani/vim

patch 8.0.0493: crash with cd command with very long argument

Problem:    Crash with cd command with very long argument.
Solution:   Check for running out of space. (Dominique pending, closes #1576)
This commit is contained in:
Bram Moolenaar
2017-03-19 21:37:13 +01:00
parent 81b9d0bd5c
commit 15618fa643
5 changed files with 58 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
set belloff=all
source test_assign.vim
source test_cd.vim
source test_changedtick.vim
source test_cursor_func.vim
source test_delete.vim

13
src/testdir/test_cd.vim Normal file
View File

@@ -0,0 +1,13 @@
" Test for :cd
func Test_cd_large_path()
" This used to crash with a heap write overflow.
call assert_fails('cd ' . repeat('x', 5000), 'E472:')
endfunc
func Test_cd_up_and_down()
let path = getcwd()
cd ..
exe 'cd ' . path
call assert_equal(path, getcwd())
endfunc