This commit is contained in:
parent
f6e2b549b6
commit
7443663dd8
24
engine/vm.c
24
engine/vm.c
@ -2525,18 +2525,8 @@ static sxi32 VmByteCodeExec(
|
|||||||
pIdx = 0;
|
pIdx = 0;
|
||||||
if(pInstr->iP1 == 0) {
|
if(pInstr->iP1 == 0) {
|
||||||
if(!pInstr->iP2) {
|
if(!pInstr->iP2) {
|
||||||
/* No available index,load NULL */
|
/* No available index, emit error */
|
||||||
if(pTos >= pStack) {
|
|
||||||
PH7_MemObjRelease(pTos);
|
|
||||||
} else {
|
|
||||||
/* TICKET 1433-020: Empty stack */
|
|
||||||
pTos++;
|
|
||||||
MemObjSetType(pTos, MEMOBJ_NULL);
|
|
||||||
pTos->nIdx = SXU32_HIGH;
|
|
||||||
}
|
|
||||||
/* Emit a notice */
|
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Attempt to access an undefined array index");
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Attempt to access an undefined array index");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pIdx = pTos;
|
pIdx = pTos;
|
||||||
@ -2567,14 +2557,8 @@ static sxi32 VmByteCodeExec(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(pInstr->iP2 && (pTos->iFlags & MEMOBJ_HASHMAP) == 0) {
|
if((pTos->iFlags & MEMOBJ_HASHMAP) == 0) {
|
||||||
if(pTos->nIdx != SXU32_HIGH) {
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Subscripted value is neither array nor string");
|
||||||
ph7_value *pObj;
|
|
||||||
if((pObj = (ph7_value *)SySetAt(&pVm->aMemObj, pTos->nIdx)) != 0) {
|
|
||||||
PH7_MemObjToHashmap(pObj);
|
|
||||||
PH7_MemObjLoad(pObj, pTos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
rc = SXERR_NOTFOUND; /* Assume the index is invalid */
|
rc = SXERR_NOTFOUND; /* Assume the index is invalid */
|
||||||
if(pTos->iFlags & MEMOBJ_HASHMAP) {
|
if(pTos->iFlags & MEMOBJ_HASHMAP) {
|
||||||
@ -2610,7 +2594,7 @@ static sxi32 VmByteCodeExec(
|
|||||||
PH7_HashmapUnref(pMap);
|
PH7_HashmapUnref(pMap);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No such entry,load NULL */
|
/* No such entry, load NULL */
|
||||||
PH7_MemObjRelease(pTos);
|
PH7_MemObjRelease(pTos);
|
||||||
pTos->nIdx = SXU32_HIGH;
|
pTos->nIdx = SXU32_HIGH;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user