]> git.kaiwu.me - quickjs.git/commitdiff
Fix UB in BigInt left shift (saghul)
authorFabrice Bellard <fabrice@bellard.org>
Mon, 7 Apr 2025 10:02:01 +0000 (12:02 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Mon, 7 Apr 2025 10:02:01 +0000 (12:02 +0200)
quickjs.c

index ae827ed4abb03e1e0a95ce3d16a08a364159bafa..702ea8fa1469f2505dd66e58845a6a273a471b8b 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -13857,7 +13857,7 @@ static no_inline __exception int js_binary_logic_slow(JSContext *ctx,
                 goto bigint_sar;
             }
         bigint_shl:
-            vd = (js_sdlimb_t)v1 << v2;
+            vd = (js_dlimb_t)v1 << v2;
             if (likely(vd >= JS_SHORT_BIG_INT_MIN &&
                        vd <= JS_SHORT_BIG_INT_MAX)) {
                 v = vd;