diff src/testdir/test_options.vim @ 11380:2334a8ae9ff6 v8.0.0575

patch 8.0.0575: using freed memory when resetting 'indentexpr' commit https://github.com/vim/vim/commit/a701b3b6f0f06ac0c9fcc75c6c34a1258fc3b1a2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 20 22:57:27 2017 +0200 patch 8.0.0575: using freed memory when resetting 'indentexpr' Problem: Using freed memory when resetting 'indentexpr' while evaluating it. (Dominique Pelle) Solution: Make a copy of 'indentexpr'.
author Christian Brabandt <cb@256bit.org>
date Thu, 20 Apr 2017 23:00:03 +0200
parents 4e5191165707
children f64c5e636c9f
line wrap: on
line diff
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -319,3 +319,16 @@ func Test_set_values()
     throw 'Skipped: opt_test.vim does not exist'
   endif
 endfunc
+
+func ResetIndentexpr()
+  set indentexpr=
+endfunc
+
+func Test_set_indentexpr()
+  " this was causing usage of freed memory
+  set indentexpr=ResetIndentexpr()
+  new
+  call feedkeys("i\<c-f>", 'x')
+  call assert_equal('', &indentexpr)
+  bwipe!
+endfunc