mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-12 11:06:10 +08:00
fixed build_arg_list()
This commit is contained in:
parent
e1f6dfe61a
commit
37cde16ba2
@ -38498,6 +38498,7 @@ static JSValue *build_arg_list(JSContext *ctx, uint32_t *plen,
|
|||||||
JSValueConst array_arg)
|
JSValueConst array_arg)
|
||||||
{
|
{
|
||||||
uint32_t len, i;
|
uint32_t len, i;
|
||||||
|
int64_t len64;
|
||||||
JSValue *tab, ret;
|
JSValue *tab, ret;
|
||||||
JSObject *p;
|
JSObject *p;
|
||||||
|
|
||||||
@ -38505,14 +38506,15 @@ static JSValue *build_arg_list(JSContext *ctx, uint32_t *plen,
|
|||||||
JS_ThrowTypeError(ctx, "not a object");
|
JS_ThrowTypeError(ctx, "not a object");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (js_get_length32(ctx, &len, array_arg))
|
if (js_get_length64(ctx, &len64, array_arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (len > JS_MAX_LOCAL_VARS) {
|
if (len64 > JS_MAX_LOCAL_VARS) {
|
||||||
// XXX: check for stack overflow?
|
// XXX: check for stack overflow?
|
||||||
JS_ThrowRangeError(ctx, "too many arguments in function call (only %d allowed)",
|
JS_ThrowRangeError(ctx, "too many arguments in function call (only %d allowed)",
|
||||||
JS_MAX_LOCAL_VARS);
|
JS_MAX_LOCAL_VARS);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
len = len64;
|
||||||
/* avoid allocating 0 bytes */
|
/* avoid allocating 0 bytes */
|
||||||
tab = js_mallocz(ctx, sizeof(tab[0]) * max_uint32(1, len));
|
tab = js_mallocz(ctx, sizeof(tab[0]) * max_uint32(1, len));
|
||||||
if (!tab)
|
if (!tab)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user