Firefox · SpiderMonkey
CVE-2025-13016
Logic Error in SpiderMonkey
Overview
High
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Files Changed
js/src/wasm/WasmGcObject.h
Patch
diff --git a/js/src/wasm/WasmGcObject.h b/js/src/wasm/WasmGcObject.h
index 5e688dc0f9a..8f17f12760d 100644
--- a/js/src/wasm/WasmGcObject.h
+++ b/js/src/wasm/WasmGcObject.h
@@ -160,6 +160,13 @@ class WasmArrayObject : public WasmGcObject,
return offsetToPointer<uint8_t>(offsetOfInlineStorage());
}
+ // Actual array data that follows DataHeader. The array data is a part of the
+ // `inlineStorage`.
+ template <typename T>
+ T* inlineArrayElements() {
+ return offsetToPointer<T>(offsetOfInlineArrayData());
+ }
+
// AllocKind for object creation
static inline gc::AllocKind allocKindForOOL();
static inline gc::AllocKind allocKindForIL(uint32_t storageBytes);
@@ -507,9 +514,8 @@ class MOZ_RAII StableWasmArrayObjectElements {
// elements.
MOZ_CRASH();
}
- std::copy(array->inlineStorage(),
- array->inlineStorage() + array->numElements_ * sizeof(T),
- ownElements_->begin());
+ const T* src = array->inlineArrayElements<T>();
+ std::copy(src, src + array->numElements_, ownElements_->begin());
elements_ = ownElements_->begin();
} else {
elements_ = reinterpret_cast<T*>(array->data_);
Loading diff…
References
On This Page