vim-patch:7.4.2235

Problem:    submatch() does not check for a valid argument.
Solution:   Give an error if the argument is out of range. (Dominique Pelle)

989f592f7f
This commit is contained in:
Michael Ennen
2016-12-19 17:24:21 -07:00
parent effe760b13
commit bae8a19c63
3 changed files with 11 additions and 2 deletions

View File

@@ -17129,12 +17129,16 @@ static void f_submatch(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (no < 0 || no >= NSUBEXP) {
EMSGN(_("E935: invalid submatch number: %d"), no);
return;
}
int retList = 0;
if (argvars[1].v_type != VAR_UNKNOWN) {
retList = get_tv_number_chk(&argvars[1], &error);
if (error) {
return;
return;
}
}