From: Ben Noordhuis Date: Wed, 1 Nov 2023 05:53:16 +0000 (+0100) Subject: Fix UB left shift of negative number X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/postgres_fdw.c?a=commitdiff_plain;h=8df432755914ca02476b34d9bf0e54e21d75b05f;p=quickjs.git Fix UB left shift of negative number --- diff --git a/quickjs.c b/quickjs.c index c3db038..2c1ac6b 100644 --- a/quickjs.c +++ b/quickjs.c @@ -34907,7 +34907,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;