mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 06:48:38 +09:00
Bug 1738237, don't try to create too large string buffers, r=mccr8, a=RyanVM
This commit is contained in:
parent
e5e5fa5ab3
commit
6036639e99
1 changed files with 6 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include "xpcpublic.h"
|
||||
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
@ -138,6 +139,11 @@ nsStructuredCloneContainer::GetDataAsBase64(nsAString &aOut)
|
|||
|
||||
auto iter = Data().Start();
|
||||
size_t size = Data().Size();
|
||||
CheckedInt<nsAutoCString::size_type> sizeCheck(size);
|
||||
if (!sizeCheck.isValid()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoCString binaryData;
|
||||
binaryData.SetLength(size);
|
||||
Data().ReadBytes(iter, binaryData.BeginWriting(), size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue