mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Null-check inputs for String and BigInt
Crash fix for null crash when feeding bogus strings or BigInts to StructuredClone.
This commit is contained in:
parent
dcb76fe0f7
commit
7163430d1a
1 changed files with 10 additions and 0 deletions
|
|
@ -1059,6 +1059,11 @@ JSStructuredCloneWriter::reportDataCloneError(uint32_t errorId)
|
|||
bool
|
||||
JSStructuredCloneWriter::writeString(uint32_t tag, JSString* str)
|
||||
{
|
||||
// Nullcheck input
|
||||
if (!str) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JSLinearString* linear = str->ensureLinear(context());
|
||||
if (!linear)
|
||||
return false;
|
||||
|
|
@ -1079,6 +1084,11 @@ JSStructuredCloneWriter::writeString(uint32_t tag, JSString* str)
|
|||
bool
|
||||
JSStructuredCloneWriter::writeBigInt(uint32_t tag, BigInt* bi)
|
||||
{
|
||||
// Nullcheck input
|
||||
if (!bi) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool signBit = bi->isNegative();
|
||||
size_t length = bi->digitLength();
|
||||
// The length must fit in 31 bits to leave room for a sign bit.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue