Mercurial > vim
comparison src/vim9type.c @ 26939:ae2324aca26b v8.2.3998
patch 8.2.3998: asan error for adding zero to NULL
Commit: https://github.com/vim/vim/commit/48824e952f7db8ca657fe20e66456fc19fca6815
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 4 16:05:48 2022 +0000
patch 8.2.3998: asan error for adding zero to NULL
Problem: Asan error for adding zero to NULL.
Solution: Do not compute pointer if there are no entries.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 04 Jan 2022 17:15:02 +0100 |
parents | ccb9be1cdd71 |
children | b049c3b63a67 |
comparison
equal
deleted
inserted
replaced
26938:454a33e055be | 26939:ae2324aca26b |
---|---|
1265 int skip, | 1265 int skip, |
1266 type_T **decl_type, | 1266 type_T **decl_type, |
1267 cctx_T *cctx) | 1267 cctx_T *cctx) |
1268 { | 1268 { |
1269 garray_T *stack = &cctx->ctx_type_stack; | 1269 garray_T *stack = &cctx->ctx_type_stack; |
1270 type2_T *typep = ((type2_T *)stack->ga_data) + stack->ga_len; | 1270 type2_T *typep; |
1271 garray_T *type_gap = cctx->ctx_type_list; | 1271 garray_T *type_gap = cctx->ctx_type_list; |
1272 int i; | 1272 int i; |
1273 type_T *result; | 1273 type_T *result; |
1274 type_T *decl_result; | 1274 type_T *decl_result; |
1275 type_T *type; | 1275 type_T *type; |
1281 return &t_unknown; | 1281 return &t_unknown; |
1282 } | 1282 } |
1283 | 1283 |
1284 // Use the first value type for the list member type, then find the common | 1284 // Use the first value type for the list member type, then find the common |
1285 // type from following items. | 1285 // type from following items. |
1286 typep = ((type2_T *)stack->ga_data) + stack->ga_len; | |
1286 result = (typep -(count * skip) + skip - 1)->type_curr; | 1287 result = (typep -(count * skip) + skip - 1)->type_curr; |
1287 decl_result = (typep -(count * skip) + skip - 1)->type_decl; | 1288 decl_result = (typep -(count * skip) + skip - 1)->type_decl; |
1288 for (i = 1; i < count; ++i) | 1289 for (i = 1; i < count; ++i) |
1289 { | 1290 { |
1290 if (result == &t_any) | 1291 if (result == &t_any) |