Skip to content

Commit 8df4327

Browse files
committed
Fix UB left shift of negative number
1 parent 3bb2ca3 commit 8df4327

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

quickjs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -34907,7 +34907,7 @@ static int JS_WriteBigNum(BCWriterState *s, JSValueConst obj)
3490734907
e = a->expn + 3;
3490834908
else
3490934909
e = a->expn;
34910-
e = (e << 1) | a->sign;
34910+
e = (e * 2) | a->sign;
3491134911
if (e < INT32_MIN || e > INT32_MAX) {
3491234912
JS_ThrowInternalError(s->ctx, "bignum exponent is too large");
3491334913
return -1;

0 commit comments

Comments
 (0)