From d2abd1be80774f13416f566a1e8448635f1cf5e6 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 15 Mar 2020 23:18:47 -0400 Subject: vim-patch:8.1.2147: crash when allocating memory fails Problem: Crash when allocating memory fails. (Zu-Ming Jiang) Solution: Check that 'spellcapcheck' is not NULL. (closes vim/vim#5048) https://github.com/vim/vim/commit/53efb18530cc3940d7af2ea338947783ea5495ed --- src/nvim/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvim/option.c b/src/nvim/option.c index 7582b0dc17..86a7d9b3c2 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3843,11 +3843,12 @@ static char_u *did_set_spell_option(bool is_spellfile) * Return error message when failed, NULL when OK. */ static char_u *compile_cap_prog(synblock_T *synblock) + FUNC_ATTR_NONNULL_ALL { regprog_T *rp = synblock->b_cap_prog; char_u *re; - if (*synblock->b_p_spc == NUL) { + if (synblock->b_p_spc == NULL || *synblock->b_p_spc == NUL) { synblock->b_cap_prog = NULL; } else { // Prepend a ^ so that we only match at one column -- cgit