Firefox · SpiderMonkey
CVE-2026-16368
Logic Error in SpiderMonkey
Overview
High
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Changed Functions
| Function | Change | Notes |
|---|---|---|
ifjs/src/wasm/WasmInstance.cpp |
modified |
Files Changed
js/src/wasm/WasmInstance.cpp
Patch
diff --git a/js/src/wasm/WasmInstance.cpp b/js/src/wasm/WasmInstance.cpp
index ba90b09b691..bf723f85dff 100644
--- a/js/src/wasm/WasmInstance.cpp
+++ b/js/src/wasm/WasmInstance.cpp
@@ -2632,8 +2632,14 @@ bool Instance::init(JSContext* cx, const JSObjectVector& funcImports,
// Create and initialize alloc sites, they are all the same for Wasm.
uint32_t allocSitesCount = codeTailMeta().numAllocSites;
if (allocSitesCount > 0) {
- allocSites_ =
- (gc::AllocSite*)js_malloc(sizeof(gc::AllocSite) * allocSitesCount);
+ mozilla::CheckedInt<size_t> numBytesRequired =
+ mozilla::CheckedInt<size_t>(allocSitesCount) *
+ mozilla::CheckedInt<size_t>(sizeof(gc::AllocSite));
+ if (!numBytesRequired.isValid()) {
+ ReportOutOfMemory(cx);
+ return false;
+ }
+ allocSites_ = (gc::AllocSite*)js_malloc(numBytesRequired.value());
if (!allocSites_) {
ReportOutOfMemory(cx);
return false;
Loading diff…
References
On This Page