diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-10-27 11:43:10 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-27 12:47:44 +0800 |
| commit | b793395019333127e085997b7ced4ea02053697e (patch) | |
| tree | 64b04323160d088eb16929eabe9bb69a45ed13ce /src/nvim/testdir/test_eval_stuff.vim | |
| parent | 7765f2bb8304631c00f1e00ffc73c18cd4d22601 (diff) | |
| download | rneovim-b793395019333127e085997b7ced4ea02053697e.tar.gz rneovim-b793395019333127e085997b7ced4ea02053697e.tar.bz2 rneovim-b793395019333127e085997b7ced4ea02053697e.zip | |
vim-patch:8.2.4070: using uninitialized memory when reading empty file
Problem: Using uninitialized memory when reading empty file.
Solution: Check for empty file before checking for NL. (Dominique Pellé,
closes vim/vim#9511)
https://github.com/vim/vim/commit/f5d639a8af719eb8ecb141b5c0890627e4d83134
Co-authored-by: Dominique Pelle <dominique.pelle@gmail.com>
Diffstat (limited to 'src/nvim/testdir/test_eval_stuff.vim')
| -rw-r--r-- | src/nvim/testdir/test_eval_stuff.vim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim index dc110af356..5c60b64c22 100644 --- a/src/nvim/testdir/test_eval_stuff.vim +++ b/src/nvim/testdir/test_eval_stuff.vim @@ -120,6 +120,13 @@ func Test_readfile_binary() call delete('XReadfile_bin') endfunc +func Test_readfile_binary_empty() + call writefile([], 'Xempty-file') + " This used to compare uninitialized memory in Vim <= 8.2.4065 + call assert_equal([''], readfile('Xempty-file', 'b')) + call delete('Xempty-file') +endfunc + func Test_readfile_bom() call writefile(["\ufeffFOO", "FOO\ufeffBAR"], 'XReadfile_bom') call assert_equal(['FOO', 'FOOBAR'], readfile('XReadfile_bom')) |