diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-03-18 01:15:27 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-04-13 12:00:32 -0400 |
commit | 16a4581349f45f4030a4a361228bc1d69fb7e45f (patch) | |
tree | baecf7f7cb62c50a3bbb6c2e0252b3e20a32292a /src/nvim/regexp.c | |
parent | dbb386e1b277004e37902fd1c794727277312765 (diff) | |
download | rneovim-16a4581349f45f4030a4a361228bc1d69fb7e45f.tar.gz rneovim-16a4581349f45f4030a4a361228bc1d69fb7e45f.tar.bz2 rneovim-16a4581349f45f4030a4a361228bc1d69fb7e45f.zip |
vim-patch:8.1.2282: crash when passing many arguments through a partial
Problem: Crash when passing many arguments through a partial. (Andy
Massimino)
Solution: Check the number of arguments. (closes vim/vim#5186)
https://github.com/vim/vim/commit/4c054e9fb23027b55a09ee647a3a2c91936aeb1b
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index dba7c53c10..5ad7ce9a16 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -6683,10 +6683,15 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, // fill_submatch_list() was called. clear_submatch_list(&matchList); } - char buf[NUMBUFLEN]; - eval_result = (char_u *)tv_get_string_buf_chk(&rettv, buf); - if (eval_result != NULL) { - eval_result = vim_strsave(eval_result); + if (rettv.v_type == VAR_UNKNOWN) { + // something failed, no need to report another error + eval_result = NULL; + } else { + char buf[NUMBUFLEN]; + eval_result = (char_u *)tv_get_string_buf_chk(&rettv, buf); + if (eval_result != NULL) { + eval_result = vim_strsave(eval_result); + } } tv_clear(&rettv); } else { |