diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-04 16:05:48 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-04 16:05:48 +0000 |
commit | 48824e952f7db8ca657fe20e66456fc19fca6815 (patch) | |
tree | 01458309307e280ec101525c72ef04089d7af8a3 | |
parent | 10d6f18b2f9090d19dd884827c4be59a20b446bf (diff) |
patch 8.2.3998: asan error for adding zero to NULLv8.2.3998
Problem: Asan error for adding zero to NULL.
Solution: Do not compute pointer if there are no entries.
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9type.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/version.c b/src/version.c index 170c0c2e62..4f40aab7ab 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3998, +/**/ 3997, /**/ 3996, diff --git a/src/vim9type.c b/src/vim9type.c index f2ed15b48c..f28b88f236 100644 --- a/src/vim9type.c +++ b/src/vim9type.c @@ -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) |