mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Reset m_fastModeData of ArrayObject for the case of exception during ArrayObject creation
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
28451a704f
commit
fa209656d5
2 changed files with 15 additions and 0 deletions
|
|
@ -74,6 +74,15 @@ ArrayObject::ArrayObject(ExecutionState& state, Object* proto, const uint64_t& s
|
|||
: ArrayObject(state, proto)
|
||||
{
|
||||
if (UNLIKELY(size > ((1LL << 32LL) - 1LL))) {
|
||||
if (UNLIKELY(state.context()->vmInstance()->didSomePrototypeObjectDefineIndexedProperty())) {
|
||||
// m_fastModeData has the initial value `DummyArrayElement`
|
||||
// this could trigger an error while destructing of m_fastModeData when an exception thrown right after here
|
||||
#if defined(ESCARGOT_64) && defined(ESCARGOT_USE_32BIT_IN_64BIT)
|
||||
m_fastModeData.reset();
|
||||
#else
|
||||
m_fastModeData = nullptr;
|
||||
#endif
|
||||
}
|
||||
ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, ErrorObject::Messages::GlobalObject_InvalidArrayLength);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -436,6 +436,12 @@ public:
|
|||
m_buffer = resetData;
|
||||
}
|
||||
|
||||
// used for specific case
|
||||
void reset()
|
||||
{
|
||||
m_buffer = nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
T* m_buffer;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue