]> granicus.if.org Git - vim/commitdiff
patch 8.2.3998: asan error for adding zero to NULL v8.2.3998
authorBram Moolenaar <Bram@vim.org>
Tue, 4 Jan 2022 16:05:48 +0000 (16:05 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 4 Jan 2022 16:05:48 +0000 (16:05 +0000)
Problem:    Asan error for adding zero to NULL.
Solution:   Do not compute pointer if there are no entries.

src/version.c
src/vim9type.c

index 170c0c2e626c1ba61dc452fbad5a515320762959..4f40aab7ab164b86994052c1ea6f1be6956ef86e 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3998,
 /**/
     3997,
 /**/
index f2ed15b48c13917202e9ca60185f2e53c1b82960..f28b88f2365ee650d62395952053470d36290dc8 100644 (file)
@@ -1267,7 +1267,7 @@ get_member_type_from_stack(
        cctx_T      *cctx)
 {
     garray_T   *stack = &cctx->ctx_type_stack;
-    type2_T    *typep = ((type2_T *)stack->ga_data) + stack->ga_len;
+    type2_T    *typep;
     garray_T    *type_gap = cctx->ctx_type_list;
     int                i;
     type_T     *result;
@@ -1283,6 +1283,7 @@ get_member_type_from_stack(
 
     // Use the first value type for the list member type, then find the common
     // type from following items.
+    typep = ((type2_T *)stack->ga_data) + stack->ga_len;
     result = (typep -(count * skip) + skip - 1)->type_curr;
     decl_result = (typep -(count * skip) + skip - 1)->type_decl;
     for (i = 1; i < count; ++i)