From 0b0bc496a17f495dbe4da170e7a0b728d9ae3c52 Mon Sep 17 00:00:00 2001 From: He-Pin Date: Fri, 27 Feb 2026 20:49:42 +0800 Subject: [PATCH] chore: Avoid left-shift of negative values port https://github.com/google/jsonnet/pull/1288 --- sjsonnet/src/sjsonnet/Evaluator.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sjsonnet/src/sjsonnet/Evaluator.scala b/sjsonnet/src/sjsonnet/Evaluator.scala index 15126c4b..e573d35e 100644 --- a/sjsonnet/src/sjsonnet/Evaluator.scala +++ b/sjsonnet/src/sjsonnet/Evaluator.scala @@ -568,7 +568,7 @@ class Evaluator( if (rr < 0) { Error.fail("shift by negative exponent", pos) } - if (rr >= 1 && ll >= (1L << (63 - rr))) + if (rr >= 1 && math.abs(ll) >= (1L << (63 - rr))) Error.fail("numeric value outside safe integer range for bitwise operation", pos) else Val.Num(pos, (ll << rr).toDouble)