1
0
forked from aniani/vim

patch 9.0.0552: crash when using NUL in buffer that uses :source

Problem:    Crash when using NUL in buffer that uses :source.
Solution:   Don't get a next line when skipping over NL.
This commit is contained in:
Bram Moolenaar
2022-09-22 21:35:19 +01:00
parent f87eeb43fb
commit 69082916c8
3 changed files with 21 additions and 2 deletions

View File

@@ -665,5 +665,22 @@ func Test_source_buffer_long_line()
call delete('Xtest.vim')
endfunc
func Test_source_buffer_with_NUL_char()
" This was trying to use a line below the buffer.
let lines =<< trim END
if !exists('g:loaded')
let g:loaded = 1
source
endif
END
" Can't have a NL in heredoc
let lines += ["silent! vim9 echo [0 \<NL> ? 'a' : 'b']"]
call writefile(lines, 'XsourceNul', '')
edit XsourceNul
source
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab