js: check bi before using it in JSStructuredCloneWriter::writeBigInt()

This commit is contained in:
roytam1 2025-02-05 19:18:13 +08:00
commit de916190fd

View file

@ -1079,6 +1079,8 @@ JSStructuredCloneWriter::writeString(uint32_t tag, JSString* str)
bool
JSStructuredCloneWriter::writeBigInt(uint32_t tag, BigInt* bi)
{
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.