vim-patch:9.1.0758: it's possible to set an invalid key to 'wildcharm' (#30662)

Problem:  it's possible to set an invalid key to 'wildcharm'
Solution: error out, if the 'wildcharm' value is an invalid key
          (Milly)

closes: vim/vim#15787

40c6babc17

Co-authored-by: Milly <milly.ca@gmail.com>
This commit is contained in:
zeertzjq 2024-10-05 07:20:38 +08:00 committed by GitHub
parent 289380bc40
commit ab98c5b5a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1216,8 +1216,9 @@ static OptVal get_option_newval(OptIndex opt_idx, int opt_flags, set_prefix_T pr
// Different ways to set a number option:
// & set to default value
// < set to global value
// <xx> accept special key codes for 'wildchar'
// c accept any non-digit for 'wildchar'
// <xx> accept special key codes for 'wildchar' or 'wildcharm'
// ^x accept ctrl key codes for 'wildchar' or 'wildcharm'
// c accept any non-digit for 'wildchar' or 'wildcharm'
// [-]0-9 set number
// other error
arg++;
@ -1239,7 +1240,7 @@ static OptVal get_option_newval(OptIndex opt_idx, int opt_flags, set_prefix_T pr
|| (*arg != NUL && (!arg[1] || ascii_iswhite(arg[1]))
&& !ascii_isdigit(*arg)))) {
newval_num = string_to_key(arg);
if (newval_num == 0 && (OptInt *)varp != &p_wcm) {
if (newval_num == 0) {
*errmsg = e_invarg;
return newval;
}