comparison src/vim9compile.c @ 22663:0f90c15a4a28 v8.2.1880

patch 8.2.1880: Vim9: asan complains about adding zero to NULL Commit: https://github.com/vim/vim/commit/af7a9066a956db23a8bc67bc1f82466e3eff55ea Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 21 16:49:17 2020 +0200 patch 8.2.1880: Vim9: asan complains about adding zero to NULL Problem: Vim9: Asan complains about adding zero to NULL. Solution: Check for argument count first.
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Oct 2020 17:00:03 +0200
parents c6b17787a38f
children 87987c783087
comparison
equal deleted inserted replaced
22662:0f6e0cc4e927 22663:0f90c15a4a28
1473 return FAIL; 1473 return FAIL;
1474 isn->isn_arg.shuffle.shfl_item = argcount; 1474 isn->isn_arg.shuffle.shfl_item = argcount;
1475 isn->isn_arg.shuffle.shfl_up = argoff - 1; 1475 isn->isn_arg.shuffle.shfl_up = argoff - 1;
1476 } 1476 }
1477 1477
1478 // Check the types of the arguments. 1478 if (argcount > 0)
1479 argtypes = ((type_T **)stack->ga_data) + stack->ga_len - argcount; 1479 {
1480 if (argcount > 0 && internal_func_check_arg_types( 1480 // Check the types of the arguments.
1481 argtypes, func_idx, argcount) == FAIL) 1481 argtypes = ((type_T **)stack->ga_data) + stack->ga_len - argcount;
1482 if (internal_func_check_arg_types(argtypes, func_idx, argcount) == FAIL)
1482 return FAIL; 1483 return FAIL;
1484 }
1483 1485
1484 if ((isn = generate_instr(cctx, ISN_BCALL)) == NULL) 1486 if ((isn = generate_instr(cctx, ISN_BCALL)) == NULL)
1485 return FAIL; 1487 return FAIL;
1486 isn->isn_arg.bfunc.cbf_idx = func_idx; 1488 isn->isn_arg.bfunc.cbf_idx = func_idx;
1487 isn->isn_arg.bfunc.cbf_argcount = argcount; 1489 isn->isn_arg.bfunc.cbf_argcount = argcount;