Firefox · DOM
CVE-2026-109717
Logic Error in DOM
Overview
High
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Changed Functions
| Function | Change | Notes |
|---|---|---|
ifdom/media/webcodecs/AudioData.cpp |
modified | |
fordom/media/webcodecs/AudioData.cpp |
modified | |
fordom/media/webcodecs/EncodedAudioChunk.cpp |
modified | |
fordom/media/webcodecs/ImageDecoder.cpp |
modified | |
ifdom/media/webcodecs/ImageDecoder.cpp |
modified |
Files Changed
dom/media/webcodecs/AudioData.cppdom/media/webcodecs/EncodedAudioChunk.cppdom/media/webcodecs/ImageDecoder.cpp
Patch
diff --git a/dom/media/webcodecs/AudioData.cpp b/dom/media/webcodecs/AudioData.cpp
index b097a097bc7..7e9fa507472 100644
--- a/dom/media/webcodecs/AudioData.cpp
+++ b/dom/media/webcodecs/AudioData.cpp
@@ -9,6 +9,7 @@
#include "AudioSampleFormat.h"
#include "WebCodecsUtils.h"
#include "js/StructuredClone.h"
+#include "jsapi.h"
#include "mozilla/Assertions.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/Logging.h"
@@ -266,6 +267,10 @@ already_AddRefed<AudioData> AudioData::Constructor(const GlobalObject& aGlobal,
}
UniquePtr<uint8_t[], JS::FreePolicy> transferData;
if (transferLen) {
+ if (!JS_WrapObject(aGlobal.Context(), &*transferBuffer)) {
+ aRv.NoteJSContextException(aGlobal.Context());
+ return nullptr;
+ }
void* bufferContents =
JS::StealArrayBufferContents(aGlobal.Context(), *transferBuffer);
if (!bufferContents) {
@@ -290,6 +295,10 @@ already_AddRefed<AudioData> AudioData::Constructor(const GlobalObject& aGlobal,
// 9.2.2.3.1. Perform DetachArrayBuffer on transferable
for (const auto& buffer : aInit.mTransfer) {
JS::Rooted<JSObject*> obj(aGlobal.Context(), buffer.Obj());
+ if (!JS_WrapObject(aGlobal.Context(), &obj)) {
+ aRv.NoteJSContextException(aGlobal.Context());
+ return nullptr;
+ }
JS::DetachArrayBuffer(aGlobal.Context(), obj);
}
return MakeAndAddRef<AudioData>(global, resource.unwrap(), aInit);
diff --git a/dom/media/webcodecs/EncodedAudioChunk.cpp b/dom/media/webcodecs/EncodedAudioChunk.cpp
index 43d4ac29ed1..6ff80eb521d 100644
--- a/dom/media/webcodecs/EncodedAudioChunk.cpp
+++ b/dom/media/webcodecs/EncodedAudioChunk.cpp
@@ -8,6 +8,7 @@
#include "MediaData.h"
#include "TimeUnits.h"
+#include "jsapi.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/Logging.h"
#include "mozilla/PodOperations.h"
@@ -187,6 +188,10 @@ already_AddRefed<EncodedAudioChunk> EncodedAudioChunk::Constructor(
JS::Rooted<JSObject*> transferBuffer(aGlobal.Context(),
data.GetAsArrayBuffer().Obj());
if (transferSet.Contains(transferBuffer)) {
+ if (!JS_WrapObject(aGlobal.Context(), &transferBuffer)) {
+ aRv.NoteJSContextException(aGlobal.Context());
+ return nullptr;
+ }
transferLength = JS::GetArrayBufferByteLength(transferBuffer);
transferData =
JS::StealArrayBufferContents(aGlobal.Context(), transferBuffer);
@@ -258,6 +263,10 @@ already_AddRefed<EncodedAudioChunk> EncodedAudioChunk::Constructor(
// 8.1.2.4.1. Perform DetachArrayBuffer on transferable
for (const auto& buffer : aInit.mTransfer) {
JS::Rooted<JSObject*> obj(aGlobal.Context(), buffer.Obj());
+ if (!JS_WrapObject(aGlobal.Context(), &obj)) {
+ aRv.NoteJSContextException(aGlobal.Context());
+ return nullptr;
+ }
JS::DetachArrayBuffer(aGlobal.Context(), obj);
}
diff --git a/dom/media/webcodecs/ImageDecoder.cpp b/dom/media/webcodecs/ImageDecoder.cpp
index 597d71d31f5..48dc358be58 100644
--- a/dom/media/webcodecs/ImageDecoder.cpp
+++ b/dom/media/webcodecs/ImageDecoder.cpp
@@ -10,6 +10,7 @@
#include "ImageContainer.h"
#include "ImageDecoderReadRequest.h"
#include "MediaResult.h"
+#include "jsapi.h"
#include "mozilla/Logging.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/dom/ImageTrack.h"
@@ -543,6 +544,11 @@ void ImageDecoder::CheckOutstandingDecodes() {
// 10.2.2.19.1. Perform DetachArrayBuffer on transferable
for (const auto& buffer : aInit.mTransfer) {
JS::Rooted<JSObject*> obj(aGlobal.Context(), buffer.Obj());
+ if (!JS_WrapObject(aGlobal.Context(), &obj)) {
+ aRv.MightThrowJSException();
+ aRv.StealExceptionFromJSContext(aGlobal.Context());
+ return nullptr;
+ }
JS::DetachArrayBuffer(aGlobal.Context(), obj);
}
@@ -722,6 +728,11 @@ void ImageDecoder::Initialize(const GlobalObject& aGlobal,
if (transferOwnership) {
JS::Rooted<JSObject*> bufferObj(aGlobal.Context(), buffer.Obj());
size_t length = JS::GetArrayBufferByteLength(bufferObj);
+ if (!JS_WrapObject(aGlobal.Context(), &bufferObj)) {
+ aRv.MightThrowJSException();
+ aRv.StealExceptionFromJSContext(aGlobal.Context());
+ return;
+ }
void* data = JS::StealArrayBufferContents(aGlobal.Context(), bufferObj);
if (!data) {
// Stealing failed: either the buffer can't be detached (eg backed by
Loading diff…
References
On This Page