Eliminate segfault when array changes to non-fast mode (#252)

Fixes #132

Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
This commit is contained in:
Peter Marki 2019-05-14 10:42:29 +02:00 committed by yichoi
commit 4e1d74c2df
2 changed files with 21 additions and 1 deletions

View file

@ -425,8 +425,8 @@ Value ByteCodeInterpreter::interpret(ExecutionState& state, ByteCodeBlock* byteC
const Value& property = registerFile[code->m_propertyRegisterIndex];
if (LIKELY(willBeObject.isObject() && (willBeObject.asPointerValue())->hasTag(g_arrayObjectTag))) {
ArrayObject* arr = willBeObject.asObject()->asArrayObject();
uint32_t idx = property.tryToUseAsArrayIndex(state);
if (LIKELY(arr->isFastModeArray())) {
uint32_t idx = property.tryToUseAsArrayIndex(state);
if (LIKELY(idx != Value::InvalidArrayIndexValue)) {
uint32_t len = arr->getArrayLength(state);
if (UNLIKELY(len <= idx)) {