mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.0370: invalid memory access when setting wildchar empty
Problem: Invalid memory access when setting wildchar empty.
Solution: Avoid going over the end of the option value. (Dominique Pelle,
closes vim/vim#1509) Make option test check all number options with
empty value.
a12e40351d
This commit is contained in:
parent
fe191d95a2
commit
bcc174e6df
@ -1434,7 +1434,7 @@ do_set (
|
|||||||
|| (long *)varp == &p_wcm)
|
|| (long *)varp == &p_wcm)
|
||||||
&& (*arg == '<'
|
&& (*arg == '<'
|
||||||
|| *arg == '^'
|
|| *arg == '^'
|
||||||
|| ((!arg[1] || ascii_iswhite(arg[1]))
|
|| (*arg != NUL && (!arg[1] || ascii_iswhite(arg[1]))
|
||||||
&& !ascii_isdigit(*arg)))) {
|
&& !ascii_isdigit(*arg)))) {
|
||||||
value = string_to_key(arg);
|
value = string_to_key(arg);
|
||||||
if (value == 0 && (long *)varp != &p_wcm) {
|
if (value == 0 && (long *)varp != &p_wcm) {
|
||||||
|
@ -29,6 +29,19 @@ function! Test_isfname()
|
|||||||
set isfname&
|
set isfname&
|
||||||
endfunction
|
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()
|
function! Test_options()
|
||||||
let caught = 'ok'
|
let caught = 'ok'
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user