Consider private attributes to be accessed. Fix access check.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-05-29 20:16:02 +02:00
parent c206011c95
commit 1bf5c3a8a2
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 3 additions and 3 deletions

View File

@ -4215,7 +4215,7 @@ static sxi32 VmByteCodeExec(
if(SyStrncmp(pObjAttr->pAttr->sName.zString, sName.zString, sName.nByte) == 0) {
if(pNos->iFlags != MEMOBJ_PARENTOBJ && pObjAttr->pAttr->pClass == pClass) {
break;
} else if(pNos->iFlags != MEMOBJ_BASEOBJ && pObjAttr->pAttr->iProtection != PH7_CLASS_PROT_PRIVATE) {
} else if(pNos->iFlags != MEMOBJ_BASEOBJ) {
SyHashEntry *pDerived = SyHashGet(&pClass->hDerived, (const void *)pObjAttr->pAttr->pClass->sName.zString, pObjAttr->pAttr->pClass->sName.nByte);
if(pDerived != 0) {
ph7_class *pSub = (ph7_class *)pDerived->pUserData;
@ -4244,7 +4244,7 @@ static sxi32 VmByteCodeExec(
if(pObjAttr) {
ph7_value *pValue = 0; /* cc warning */
/* Check attribute access */
if(VmClassMemberAccess(&(*pVm), pClass, pObjAttr->pAttr->iProtection)) {
if(VmClassMemberAccess(&(*pVm), pObjAttr->pAttr->pClass, pObjAttr->pAttr->iProtection)) {
/* Load attribute */
pValue = (ph7_value *)SySetAt(&pVm->aMemObj, pObjAttr->nIdx);
if(pValue) {
@ -4266,7 +4266,7 @@ static sxi32 VmByteCodeExec(
}
} else {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR,
"Class attribute '%z->%z' is inaccessible due to its protection level", &pClass->sName, &pObjAttr->pAttr->sName);
"Class attribute '%z->%z' is inaccessible due to its protection level", &pObjAttr->pAttr->pClass->sName, &pObjAttr->pAttr->sName);
}
}
/* Safely unreference the object */