Bug 1932169 - Throw an error when UnderlyingSource.autoAllocateChunkSize is too large on 32-bit build. a=RyanVM

Original Revision: https://phabricator.services.mozilla.com/D229811

Differential Revision: https://phabricator.services.mozilla.com/D230269
This commit is contained in:
Tooru Fujisawa 2024-12-05 19:10:09 +00:00
parent 95d4e56bd1
commit b65ddd3121
2 changed files with 9 additions and 0 deletions

View file

@ -2072,6 +2072,14 @@ void SetUpReadableByteStreamControllerFromUnderlyingSource(
aRv.ThrowTypeError("autoAllocateChunkSize can not be zero.");
return;
}
if constexpr (sizeof(size_t) == sizeof(uint32_t)) {
if (value > uint64_t(UINT32_MAX)) {
aRv.ThrowRangeError("autoAllocateChunkSize too large");
return;
}
}
autoAllocateChunkSize = mozilla::Some(value);
}

View file

@ -30,3 +30,4 @@ run-sequentially = "very high failure rate in parallel"
["subclassing.js"]
["too-big-array-buffer.js"]
skip-if = ["bits == 32"] # autoAllocateChunkSize limit is different on 32-bit