comparison src/vim9compile.c @ 24061:d6489b4eb14e v8.2.2572

patch 8.2.2572: Vim9: crash when getting the types for a legacy function Commit: https://github.com/vim/vim/commit/18062fcad648540369db5989aac297431119e037 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 5 21:35:47 2021 +0100 patch 8.2.2572: Vim9: crash when getting the types for a legacy function Problem: Vim9: crash when getting the types for a legacy function. Solution: Initialize the type list growarray. (closes https://github.com/vim/vim/issues/7929)
author Bram Moolenaar <Bram@vim.org>
date Fri, 05 Mar 2021 21:45:02 +0100
parents 308d29307910
children 780dec2ffa6b
comparison
equal deleted inserted replaced
24060:1a3bde529268 24061:d6489b4eb14e
272 272
273 /* 273 /*
274 * Lookup a script-local variable in the current script, possibly defined in a 274 * Lookup a script-local variable in the current script, possibly defined in a
275 * block that contains the function "cctx->ctx_ufunc". 275 * block that contains the function "cctx->ctx_ufunc".
276 * "cctx" is NULL at the script level. 276 * "cctx" is NULL at the script level.
277 * if "len" is <= 0 "name" must be NUL terminated. 277 * If "len" is <= 0 "name" must be NUL terminated.
278 * Return NULL when not found. 278 * Return NULL when not found.
279 */ 279 */
280 static sallvar_T * 280 static sallvar_T *
281 find_script_var(char_u *name, size_t len, cctx_T *cctx) 281 find_script_var(char_u *name, size_t len, cctx_T *cctx)
282 { 282 {
8728 // argument types. 8728 // argument types.
8729 // A vararg is included in uf_args.ga_len but not in uf_arg_types. 8729 // A vararg is included in uf_args.ga_len but not in uf_arg_types.
8730 // The type is included in "tt_args". 8730 // The type is included in "tt_args".
8731 if (argcount > 0 || varargs) 8731 if (argcount > 0 || varargs)
8732 { 8732 {
8733 if (ufunc->uf_type_list.ga_itemsize == 0)
8734 ga_init2(&ufunc->uf_type_list, sizeof(type_T *), 10);
8733 ufunc->uf_func_type = alloc_func_type(ufunc->uf_ret_type, 8735 ufunc->uf_func_type = alloc_func_type(ufunc->uf_ret_type,
8734 argcount, &ufunc->uf_type_list); 8736 argcount, &ufunc->uf_type_list);
8735 // Add argument types to the function type. 8737 // Add argument types to the function type.
8736 if (func_type_add_arg_types(ufunc->uf_func_type, 8738 if (func_type_add_arg_types(ufunc->uf_func_type,
8737 argcount + varargs, 8739 argcount + varargs,