Patch 8.2.0097
Problem: Crash with autocommand and spellfile. (Tim Pope)
Solution: Do not pop exestack when not pushed. (closes #5450)
Files: src/testdir/test_autocmd.vim, src/spellfile.c
*** ../vim-8.2.0096/src/testdir/test_autocmd.vim 2019-12-07
17:03:52.000000000 +0100
--- src/testdir/test_autocmd.vim 2020-01-07 19:04:40.742338284 +0100
***************
*** 2335,2337 ****
--- 2335,2359 ----
call delete('Xtest')
call delete('Xtest2')
endfunc
+
+ func Test_FileType_spell()
+ if !isdirectory('/tmp')
+ throw "Skipped: requires /tmp directory"
+ endif
+
+ " this was crashing with an invalid free()
+ setglobal spellfile=/tmp/en.utf-8.add
+ augroup crash
+ autocmd!
+ autocmd BufNewFile,BufReadPost crashfile setf somefiletype
+ autocmd BufNewFile,BufReadPost crashfile set ft=anotherfiletype
+ autocmd FileType anotherfiletype setlocal spell
+ augroup END
+ func! NoCrash() abort
+ edit /tmp/crashfile
+ endfunc
+ call NoCrash()
+
+ au! crash
+ setglobal spellfile=
+ endfunc
*** ../vim-8.2.0096/src/spellfile.c 2019-12-29 23:04:20.294639884 +0100
--- src/spellfile.c 2020-01-07 20:08:39.976790769 +0100
***************
*** 352,357 ****
--- 352,358 ----
slang_T *lp = NULL;
int c = 0;
int res;
+ int did_estack_push = FALSE;
fd = mch_fopen((char *)fname, "r");
if (fd == NULL)
***************
*** 392,397 ****
--- 393,399 ----
// Set sourcing_name, so that error messages mention the file name.
estack_push(ETYPE_SPELL, fname, 0);
+ did_estack_push = TRUE;
/*
* <HEADER>: <fileID>
***************
*** 578,584 ****
endOK:
if (fd != NULL)
fclose(fd);
! estack_pop();
return lp;
}
--- 580,587 ----
endOK:
if (fd != NULL)
fclose(fd);
! if (did_estack_push)
! estack_pop();
return lp;
}
*** ../vim-8.2.0096/src/version.c 2020-01-06 23:07:44.808998838 +0100
--- src/version.c 2020-01-07 19:05:31.798173638 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 97,
/**/
--
The Law, in its majestic equality, forbids the rich, as well as the
poor, to sleep under the bridges, to beg in the streets, and to steal
bread. -- Anatole France
/// 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202001071912.007JCDZS012853%40masaka.moolenaar.net.