1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

[DOM] Validate size in FileReader.

This commit is contained in:
Moonchild
2026-04-29 11:30:43 +02:00
committed by roytam1
parent c748294a4a
commit dceb1c4fe6
+7 -1
View File
@@ -395,8 +395,14 @@ FileReader::ReadFileContent(Blob& aBlob,
return;
}
CheckedInt<size_t> size(mTotal);
if (!size.isValid()) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;
}
if (mDataFormat == FILE_AS_ARRAYBUFFER) {
mFileData = js_pod_malloc<char>(mTotal);
mFileData = js_pod_malloc<char>(size.value());
if (!mFileData) {
NS_WARNING("Preallocation failed for ReadFileData");
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);