Patch 8.0.0575
Problem: Using freed memory when resetting 'indentexpr' while evaluating
it. (Dominique Pelle)
Solution: Make a copy of 'indentexpr'.
Files: src/misc1.c, src/testdir/test_options.vim
*** ../vim-8.0.0574/src/misc1.c 2017-03-16 17:23:26.827815840 +0100
--- src/misc1.c 2017-04-20 22:54:31.964363642 +0200
***************
*** 9252,9257 ****
--- 9252,9258 ----
get_expr_indent(void)
{
int indent;
+ char_u *inde_copy;
pos_T save_pos;
colnr_T save_curswant;
int save_set_curswant;
***************
*** 9268,9274 ****
if (use_sandbox)
++sandbox;
++textlock;
! indent = (int)eval_to_number(curbuf->b_p_inde);
if (use_sandbox)
--sandbox;
--textlock;
--- 9269,9284 ----
if (use_sandbox)
++sandbox;
++textlock;
!
! /* Need to make a copy, the 'indentexpr' option could be changed while
! * evaluating it. */
! inde_copy = vim_strsave(curbuf->b_p_inde);
! if (inde_copy != NULL)
! {
! indent = (int)eval_to_number(inde_copy);
! vim_free(inde_copy);
! }
!
if (use_sandbox)
--sandbox;
--textlock;
*** ../vim-8.0.0574/src/testdir/test_options.vim 2017-04-09
22:54:08.517238895 +0200
--- src/testdir/test_options.vim 2017-04-20 22:50:03.114139935 +0200
***************
*** 319,321 ****
--- 319,334 ----
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
*** ../vim-8.0.0574/src/version.c 2017-04-20 22:44:42.600262225 +0200
--- src/version.c 2017-04-20 22:56:15.699679778 +0200
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 575,
/**/
--
Courtroom Quote #19:
Q: Doctor, how many autopsies have you performed on dead people?
A: All my autopsies have been performed on dead people.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.