Patch 8.0.0370
Problem:    Invalid memory access when setting wildchar empty.
Solution:   Avoid going over the end of the option value. (Dominique Pelle,
            closes #1509)  Make option test check all number options with
            empty value.
Files:      src/gen_opt_test.vim, src/option.c, src/testdir/test_options.vim


*** ../vim-8.0.0369/src/gen_opt_test.vim        2017-02-25 21:12:25.418784376 
+0100
--- src/gen_opt_test.vim        2017-02-25 21:23:34.874399493 +0100
***************
*** 46,51 ****
--- 46,52 ----
        \ 'updatecount': [[0, 1, 8, 9999], [-1]],
        \ 'updatetime': [[0, 1, 8, 9999], [-1]],
        \ 'verbose': [[-1, 0, 1, 8, 9999], []],
+       \ 'wildcharm': [[-1, 0, 100], []],
        \ 'winheight': [[1, 10, 999], [-1, 0]],
        \ 'winminheight': [[0, 1], [-1]],
        \ 'winminwidth': [[0, 1, 10], [-1]],
***************
*** 137,143 ****
        \ 'rubydll': [[], []],
        \ 'tcldll': [[], []],
        \
!       \ 'othernum': [[-1, 0, 100], []],
        \ 'otherstring': [['', 'xxx'], []],
        \}
  
--- 138,144 ----
        \ 'rubydll': [[], []],
        \ 'tcldll': [[], []],
        \
!       \ 'othernum': [[-1, 0, 100], ['']],
        \ 'otherstring': [['', 'xxx'], []],
        \}
  
*** ../vim-8.0.0369/src/option.c        2017-02-25 21:12:25.418784376 +0100
--- src/option.c        2017-02-25 21:27:46.256760999 +0100
***************
*** 4612,4618 ****
                                    || (long *)varp == &p_wcm)
                                && (*arg == '<'
                                    || *arg == '^'
!                                   || ((!arg[1] || vim_iswhite(arg[1]))
                                        && !VIM_ISDIGIT(*arg))))
                        {
                            value = string_to_key(arg);
--- 4612,4618 ----
                                    || (long *)varp == &p_wcm)
                                && (*arg == '<'
                                    || *arg == '^'
!                                   || (*arg != NUL && (!arg[1] || 
vim_iswhite(arg[1]))
                                        && !VIM_ISDIGIT(*arg))))
                        {
                            value = string_to_key(arg);
***************
*** 5843,5849 ****
                                                           opt_flags)) == NULL)
            did_set_option(opt_idx, opt_flags, TRUE);
  
!       /* call autocomamnd after handling side effects */
  #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
        if (saved_oldval != NULL)
        {
--- 5843,5849 ----
                                                           opt_flags)) == NULL)
            did_set_option(opt_idx, opt_flags, TRUE);
  
!       /* call autocommand after handling side effects */
  #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
        if (saved_oldval != NULL)
        {
*** ../vim-8.0.0369/src/testdir/test_options.vim        2017-02-25 
20:40:31.758696482 +0100
--- src/testdir/test_options.vim        2017-02-25 21:27:13.784972419 +0100
***************
*** 29,34 ****
--- 29,47 ----
    set isfname&
  endfunction
  
+ function Test_wildchar()
+   " Empty 'wildchar' used to access invalid memory.
+   call assert_fails('set wildchar=', 'E521:')
+   call assert_fails('set wildchar=abc', 'E521:')
+   set wildchar=<Esc>
+   let a=execute('set wildchar?')
+   call assert_equal("\n  wildchar=<Esc>", a)
+   set wildchar=27
+   let a=execute('set wildchar?')
+   call assert_equal("\n  wildchar=<Esc>", a)
+   set wildchar&
+ endfunction
+ 
  function Test_options()
    let caught = 'ok'
    try
*** ../vim-8.0.0369/src/version.c       2017-02-25 21:12:25.418784376 +0100
--- src/version.c       2017-02-25 21:26:49.201132526 +0100
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     370,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
28. You have comandeered your teenager's phone line for the net and even his
    friends know not to call on his line anymore.

 /// 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.

Raspunde prin e-mail lui