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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user