Patch 8.0.0337
Problem: Invalid memory access in :recover command.
Solution: Avoid access before directory name. (Dominique Pelle,
closes #1488)
Files: src/Makefile, src/memline.c, src/testdir/test_alot.vim,
src/testdir/test_recover.vim
*** ../vim-8.0.0336/src/Makefile 2017-02-17 16:31:16.929294079 +0100
--- src/Makefile 2017-02-18 16:49:41.448460562 +0100
***************
*** 2177,2182 ****
--- 2177,2183 ----
test_pyx2 \
test_pyx3 \
test_quickfix \
+ test_recover \
test_regexp_latin \
test_regexp_utf8 \
test_reltime \
*** ../vim-8.0.0336/src/memline.c 2017-02-17 16:31:16.925294107 +0100
--- src/memline.c 2017-02-18 16:47:19.329495925 +0100
***************
*** 1863,1870 ****
else
{
#if defined(UNIX) || defined(WIN3264)
! p = dir_name + STRLEN(dir_name);
! if (after_pathsep(dir_name, p) && p[-1] == p[-2])
{
/* Ends with '//', Use Full path for swap name */
tail = make_percent_swname(dir_name, fname_res);
--- 1863,1872 ----
else
{
#if defined(UNIX) || defined(WIN3264)
! int len = STRLEN(dir_name);
!
! p = dir_name + len;
! if (after_pathsep(dir_name, p) && len > 1 && p[-1] == p[-2])
{
/* Ends with '//', Use Full path for swap name */
tail = make_percent_swname(dir_name, fname_res);
***************
*** 3922,3929 ****
#endif
#if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */
! s = dir_name + STRLEN(dir_name);
! if (after_pathsep(dir_name, s) && s[-1] == s[-2])
{ /* Ends with '//', Use Full path */
r = NULL;
if ((s = make_percent_swname(dir_name, fname)) != NULL)
--- 3924,3933 ----
#endif
#if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */
! int len = STRLEN(dir_name);
!
! s = dir_name + len;
! if (after_pathsep(dir_name, s) && len > 1 && s[-1] == s[-2])
{ /* Ends with '//', Use Full path */
r = NULL;
if ((s = make_percent_swname(dir_name, fname)) != NULL)
*** ../vim-8.0.0336/src/testdir/test_alot.vim 2017-02-17 16:31:16.929294079
+0100
--- src/testdir/test_alot.vim 2017-02-18 16:47:19.329495925 +0100
***************
*** 34,39 ****
--- 34,40 ----
source test_partial.vim
source test_popup.vim
source test_put.vim
+ source test_recover.vim
source test_reltime.vim
source test_searchpos.vim
source test_set.vim
*** ../vim-8.0.0336/src/testdir/test_recover.vim 2017-02-18
16:58:26.140636060 +0100
--- src/testdir/test_recover.vim 2017-02-18 16:56:25.153518210 +0100
***************
*** 0 ****
--- 1,14 ----
+ " Test :recover
+
+ func Test_recover_root_dir()
+ " This used to access invalid memory.
+ split Xtest
+ set dir=/
+ call assert_fails('recover', 'E305:')
+ close!
+
+ call assert_fails('split Xtest', 'E303:')
+ set dir&
+ endfunc
+
+ " TODO: move recover tests from test78.in to here.
*** ../vim-8.0.0336/src/version.c 2017-02-17 18:28:20.397563687 +0100
--- src/version.c 2017-02-18 16:49:07.724706267 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 337,
/**/
--
Managers are like cats in a litter box. They instinctively shuffle things
around to conceal what they've done.
(Scott Adams - The Dilbert principle)
/// 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.