|
47 | 47 | #include "quickjs.h"
|
48 | 48 | #include "libregexp.h"
|
49 | 49 | #include "libbf.h"
|
| 50 | +#include "xalloca.h" |
50 | 51 |
|
51 | 52 | #if defined(EMSCRIPTEN)
|
52 | 53 | #define DIRECT_DISPATCH 0
|
@@ -4870,7 +4871,7 @@ static JSValue js_c_function_data_call(JSContext *ctx, JSValueConst func_obj,
|
4870 | 4871 |
|
4871 | 4872 | /* XXX: could add the function on the stack for debug */
|
4872 | 4873 | if (unlikely(argc < s->length)) {
|
4873 |
| - arg_buf = alloca(sizeof(arg_buf[0]) * s->length); |
| 4874 | + arg_buf = xalloca(sizeof(arg_buf[0]) * s->length); |
4874 | 4875 | for(i = 0; i < argc; i++)
|
4875 | 4876 | arg_buf[i] = argv[i];
|
4876 | 4877 | for(i = argc; i < s->length; i++)
|
@@ -13993,7 +13994,7 @@ static JSValue js_call_c_function(JSContext *ctx, JSValueConst func_obj,
|
13993 | 13994 |
|
13994 | 13995 | if (unlikely(argc < arg_count)) {
|
13995 | 13996 | /* ensure that at least argc_count arguments are readable */
|
13996 |
| - arg_buf = alloca(sizeof(arg_buf[0]) * arg_count); |
| 13997 | + arg_buf = xalloca(sizeof(arg_buf[0]) * arg_count); |
13997 | 13998 | for(i = 0; i < argc; i++)
|
13998 | 13999 | arg_buf[i] = argv[i];
|
13999 | 14000 | for(i = argc; i < arg_count; i++)
|
@@ -14104,7 +14105,7 @@ static JSValue js_call_bound_function(JSContext *ctx, JSValueConst func_obj,
|
14104 | 14105 | arg_count = bf->argc + argc;
|
14105 | 14106 | if (js_check_stack_overflow(ctx->rt, sizeof(JSValue) * arg_count))
|
14106 | 14107 | return JS_ThrowStackOverflow(ctx);
|
14107 |
| - arg_buf = alloca(sizeof(JSValue) * arg_count); |
| 14108 | + arg_buf = xalloca(sizeof(JSValue) * arg_count); |
14108 | 14109 | for(i = 0; i < bf->argc; i++) {
|
14109 | 14110 | arg_buf[i] = bf->argv[i];
|
14110 | 14111 | }
|
@@ -14231,7 +14232,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj,
|
14231 | 14232 | init_list_head(&sf->var_ref_list);
|
14232 | 14233 | var_refs = p->u.func.var_refs;
|
14233 | 14234 |
|
14234 |
| - local_buf = alloca(alloca_size); |
| 14235 | + local_buf = xalloca(alloca_size); |
14235 | 14236 | if (unlikely(arg_allocated_size)) {
|
14236 | 14237 | int n = min_int(argc, b->arg_count);
|
14237 | 14238 | arg_buf = local_buf;
|
|
0 commit comments