1
0
forked from aniani/vim

patch 9.0.0220: invalid memory access with for loop over NULL string

Problem:    Invalid memory access with for loop over NULL string.
Solution:   Make sure mb_ptr2len() consistently returns zero for NUL.
This commit is contained in:
Bram Moolenaar
2022-08-16 17:50:38 +01:00
parent 948a3894d9
commit f6d39c31d2
4 changed files with 29 additions and 9 deletions

View File

@@ -75,6 +75,18 @@ func Test_for_invalid()
redraw
endfunc
func Test_for_over_null_string()
let save_enc = &enc
set enc=iso8859
let cnt = 0
for c in test_null_string()
let cnt += 1
endfor
call assert_equal(0, cnt)
let &enc = save_enc
endfunc
func Test_readfile_binary()
new
call setline(1, ['one', 'two', 'three'])