From: Andrea Corallo Date: Sun, 15 Dec 2019 07:58:17 +0000 (+0100) Subject: use safe alloca in declare_imported_func X-Git-Tag: emacs-28.0.90~2727^2~920 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=26ce5664ae431ec141e852a4183844d83c3f8856;p=emacs.git use safe alloca in declare_imported_func --- diff --git a/src/comp.c b/src/comp.c index 6722d7fb80e..42f3b5d04f9 100644 --- a/src/comp.c +++ b/src/comp.c @@ -330,6 +330,7 @@ static gcc_jit_field * declare_imported_func (Lisp_Object subr_sym, gcc_jit_type *ret_type, int nargs, gcc_jit_type **types) { + USE_SAFE_ALLOCA; /* Don't want to declare the same function two times. */ if (!NILP (Fgethash (subr_sym, comp.imported_funcs_h, Qnil))) xsignal2 (Qnative_ice, @@ -339,19 +340,19 @@ declare_imported_func (Lisp_Object subr_sym, gcc_jit_type *ret_type, if (nargs == MANY) { nargs = 2; - types = alloca (nargs * sizeof (* types)); + types = SAFE_ALLOCA (nargs * sizeof (* types)); types[0] = comp.ptrdiff_type; types[1] = comp.lisp_obj_ptr_type; } else if (nargs == UNEVALLED) { nargs = 1; - types = alloca (nargs * sizeof (* types)); + types = SAFE_ALLOCA (nargs * sizeof (* types)); types[0] = comp.lisp_obj_type; } else if (!types) { - types = alloca (nargs * sizeof (* types)); + types = SAFE_ALLOCA (nargs * sizeof (* types)); for (ptrdiff_t i = 0; i < nargs; i++) types[i] = comp.lisp_obj_type; } @@ -375,6 +376,7 @@ declare_imported_func (Lisp_Object subr_sym, gcc_jit_type *ret_type, SSDATA (f_ptr_name)); Fputhash (subr_sym, make_mint_ptr (field), comp.imported_funcs_h); + SAFE_FREE (); return field; }