]> granicus.if.org Git - vim/commitdiff
patch 8.2.1880: Vim9: asan complains about adding zero to NULL v8.2.1880
authorBram Moolenaar <Bram@vim.org>
Wed, 21 Oct 2020 14:49:17 +0000 (16:49 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 21 Oct 2020 14:49:17 +0000 (16:49 +0200)
Problem:    Vim9: Asan complains about adding zero to NULL.
Solution:   Check for argument count first.

src/version.c
src/vim9compile.c

index a49bdd386885dce7c3d9adce702793d83cfe204c..df8516154bf37b3bdf5784ee4d43387dc41f5940 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1880,
 /**/
     1879,
 /**/
index 8ef1f087341af08381b4076d052939f825dd1a22..934b4d6b115ae32791cc4dc86553606415cd14f6 100644 (file)
@@ -1475,11 +1475,13 @@ generate_BCALL(cctx_T *cctx, int func_idx, int argcount, int method_call)
        isn->isn_arg.shuffle.shfl_up = argoff - 1;
     }
 
-    // Check the types of the arguments.
-    argtypes = ((type_T **)stack->ga_data) + stack->ga_len - argcount;
-    if (argcount > 0 && internal_func_check_arg_types(
-                                       argtypes, func_idx, argcount) == FAIL)
+    if (argcount > 0)
+    {
+       // Check the types of the arguments.
+       argtypes = ((type_T **)stack->ga_data) + stack->ga_len - argcount;
+       if (internal_func_check_arg_types(argtypes, func_idx, argcount) == FAIL)
            return FAIL;
+    }
 
     if ((isn = generate_instr(cctx, ISN_BCALL)) == NULL)
        return FAIL;