Fix UB left shift of negative number

This commit is contained in:
Ben Noordhuis 2023-11-01 06:53:16 +01:00
parent 83e6fca8be
commit 4a8372a709

View file

@ -34192,7 +34192,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;