Bug 1849099: Report oversized allocation in lshByAbsolute r=mgaudet

I missed this case in my patch for bug 1745907.

Differential Revision: https://phabricator.services.mozilla.com/D186497
This commit is contained in:
Iain Ireland 2023-08-17 21:47:56 +00:00
parent bc6ac40861
commit f221202df3
2 changed files with 15 additions and 2 deletions

View File

@ -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 {}
}

View File

@ -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");
}