Mercurial > vim
diff src/vim9compile.c @ 22021:514d622473af v8.2.1560
patch 8.2.1560: using NULL pointers in some code
Commit: https://github.com/vim/vim/commit/9c2b06637b32742cac11bfd66b1a4e84583c6c2e
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 1 19:56:15 2020 +0200
patch 8.2.1560: using NULL pointers in some code
Problem: Using NULL pointers in some code. (James McCoy)
Solution: Avoid adding to a NULL pointer. Use byte as unsigned.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 01 Sep 2020 20:00:03 +0200 |
parents | a9e60176dcd3 |
children | 6941d3205be9 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -1147,7 +1147,10 @@ generate_NEWLIST(cctx_T *cctx, int count isn->isn_arg.number = count; // get the member type from all the items on the stack. - member = get_member_type_from_stack( + if (count == 0) + member = &t_void; + else + member = get_member_type_from_stack( ((type_T **)stack->ga_data) + stack->ga_len, count, 1, cctx->ctx_type_list); type = get_list_type(member, cctx->ctx_type_list); @@ -1180,7 +1183,10 @@ generate_NEWDICT(cctx_T *cctx, int count return FAIL; isn->isn_arg.number = count; - member = get_member_type_from_stack( + if (count == 0) + member = &t_void; + else + member = get_member_type_from_stack( ((type_T **)stack->ga_data) + stack->ga_len, count, 2, cctx->ctx_type_list); type = get_dict_type(member, cctx->ctx_type_list);