diff --git a/js/src/jit-test/tests/bigint/bug1849099.js b/js/src/jit-test/tests/bigint/bug1849099.js new file mode 100644 index 000000000000..f61a9bfb7353 --- /dev/null +++ b/js/src/jit-test/tests/bigint/bug1849099.js @@ -0,0 +1,14 @@ +// |jit-test| --fast-warmup; --no-threads + +function foo(a,b) { + a >> a + b ^ b +} + +with ({}) {} +for (var i = 0; i < 100; i++) { + foo(10n, -1n); + try { + foo(-2147483648n); + } catch {} +} diff --git a/js/src/vm/BigIntType.cpp b/js/src/vm/BigIntType.cpp index 2ca747e7e0d3..380a0741f8c4 100644 --- a/js/src/vm/BigIntType.cpp +++ b/js/src/vm/BigIntType.cpp @@ -2250,8 +2250,7 @@ BigInt* BigInt::lshByAbsolute(JSContext* cx, HandleBigInt x, HandleBigInt y) { } if (y->digitLength() > 1 || y->digit(0) > MaxBitLength) { - JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, - JSMSG_BIGINT_TOO_LARGE); + ReportOversizedAllocation(cx, JSMSG_BIGINT_TOO_LARGE); if (js::SupportDifferentialTesting()) { fprintf(stderr, "ReportOutOfMemory called\n"); }