summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-16 17:50:38 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-16 17:50:38 +0100
commitf6d39c31d2177549a986d170e192d8351bd571e2 (patch)
tree88571362c680104807bb5201a8e1f52871b8de39 /src/testdir
parent948a3894d98f5e2a6e7fc57189fe9c2a5919eebf (diff)
downloadvim-git-f6d39c31d2177549a986d170e192d8351bd571e2.tar.gz
patch 9.0.0220: invalid memory access with for loop over NULL stringv9.0.0220
Problem: Invalid memory access with for loop over NULL string. Solution: Make sure mb_ptr2len() consistently returns zero for NUL.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_eval_stuff.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index c63082e8e..313d79185 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -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'])