]> granicus.if.org Git - vim/commitdiff
patch 8.2.3693: Coverity warns for possibly using a NULL pointer v8.2.3693
authorBram Moolenaar <Bram@vim.org>
Mon, 29 Nov 2021 10:36:19 +0000 (10:36 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 29 Nov 2021 10:36:19 +0000 (10:36 +0000)
Problem:    Coverity warns for possibly using a NULL pointer.
Solution:   Check for NULL and give an error.

src/errors.h
src/version.c
src/vim9execute.c

index 3c76bb70d5cc2ae16772d96e4e66fc0a8e7027e7..5cc98e7864905ce6c2ca98e47987a7725a6a5496 100644 (file)
@@ -355,7 +355,8 @@ EXTERN char e_cannot_delete_vim9_script_function_str[]
        INIT(= N_("E1084: Cannot delete Vim9 script function %s"));
 EXTERN char e_not_callable_type_str[]
        INIT(= N_("E1085: Not a callable type: %s"));
-// E1086 unused
+EXTERN char e_function_reference_invalid[]
+       INIT(= N_("E1086: Function reference invalid"));
 EXTERN char e_cannot_use_index_when_declaring_variable[]
        INIT(= N_("E1087: Cannot use an index when declaring a variable"));
 // E1088 unused
index 90021bec308184fcb4d844b03a7b602d06eb97c8..b7fe97b2b7b9bd29671a18496d2e0e2145e939c6 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3693,
 /**/
     3692,
 /**/
index 7704635e9ab44e9563c62fd9294bad432a67d05c..de4de16e31905eca664775cb0c821ede88281c3f 100644 (file)
@@ -3189,6 +3189,12 @@ exec_instructions(ectx_T *ectx)
                    {
                        ufunc = find_func(funcref->fr_func_name, FALSE, NULL);
                    }
+                   if (ufunc == NULL)
+                   {
+                       SOURCING_LNUM = iptr->isn_lnum;
+                       emsg(_(e_function_reference_invalid));
+                       goto theend;
+                   }
                    if (fill_partial_and_closure(pt, ufunc, ectx) == FAIL)
                        goto theend;
                    tv = STACK_TV_BOT(0);