From: Fabrice Bellard Date: Mon, 28 Sep 2026 09:29:38 +0000 (+0200) Subject: fixed potential bug in 32 bit JS_ToBigInt64() (cannot happen with canonicalized bigints) X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=0d9e58551a79d73a5d0aa0eb47ed18f4d6838005;p=quickjs.git fixed potential bug in 32 bit JS_ToBigInt64() (cannot happen with canonicalized bigints) --- diff --git a/quickjs.c b/quickjs.c index 6d1dfd8..3fc0fde 100644 --- a/quickjs.c +++ b/quickjs.c @@ -14752,8 +14752,11 @@ static int JS_ToBigInt64Free(JSContext *ctx, int64_t *pres, JSValue val) /* return the value mod 2^64 */ res = p->tab[0]; #if JS_LIMB_BITS == 32 - if (p->len >= 2) + if (p->len >= 2) { res |= (uint64_t)p->tab[1] << 32; + } else { + res = (js_slimb_t)res; + } #endif JS_FreeValue(ctx, val); }