Skip to content

Fix potential conversion errors #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10890,6 +10890,8 @@ static __exception int JS_ToArrayLengthFree(JSContext *ctx, uint32_t *plen,
if (JS_TAG_IS_FLOAT64(tag)) {
double d;
d = JS_VALUE_GET_FLOAT64(val);
if (!(d >= 0 && d <= UINT32_MAX))
goto fail;
len = (uint32_t)d;
if (len != d)
goto fail;
Expand Down Expand Up @@ -37576,9 +37578,10 @@ static JSValue js_array_includes(JSContext *ctx, JSValue this_val,
int argc, JSValue *argv)
{
JSValue obj, val;
int64_t len, n, res;
int64_t len, n;
JSValue *arrp;
uint32_t count;
int res;

obj = JS_ToObject(ctx, this_val);
if (js_get_length64(ctx, &len, obj))
Expand Down Expand Up @@ -50006,8 +50009,10 @@ static JSValue js_typed_array_indexOf(JSContext *ctx, JSValue this_val,
} else
if (tag == JS_TAG_FLOAT64) {
d = JS_VALUE_GET_FLOAT64(argv[0]);
v64 = d;
is_int = (v64 == d);
if (d >= INT64_MIN && d < 0x1p63) {
v64 = d;
is_int = (v64 == d);
}
} else
if (tag == JS_TAG_BIG_INT) {
JSBigInt *p1 = JS_VALUE_GET_PTR(argv[0]);
Expand Down