about summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2023-11-01 06:53:16 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-02 18:12:24 +0100
commitfe4e8e4e2d22f253270cca071b3ad3ae19a27976 (patch)
tree5d1105497ecdba240161994dfbc881804422a4c5 /lib
parent1f7c361d05281d59773d1eaab27a1bad5425bc75 (diff)
downloadchawan-fe4e8e4e2d22f253270cca071b3ad3ae19a27976.tar.gz
Fix UB left shift of negative number
Diffstat (limited to 'lib')
-rw-r--r--lib/quickjs/quickjs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c
index 7492198f..8e691038 100644
--- a/lib/quickjs/quickjs.c
+++ b/lib/quickjs/quickjs.c
@@ -35015,7 +35015,7 @@ static int JS_WriteBigNum(BCWriterState *s, JSValueConst obj)
         e = a->expn + 3;
     else
         e = a->expn;
-    e = (e << 1) | a->sign;
+    e = (e * 2) | a->sign;
     if (e < INT32_MIN || e > INT32_MAX) {
         JS_ThrowInternalError(s->ctx, "bignum exponent is too large");
         return -1;
'n127' href='#n127'>127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180