From 5e7d5957e2870b9a1f8749660b2236366920229b Mon Sep 17 00:00:00 2001 From: belliash Date: Thu, 9 May 2019 13:43:01 +0200 Subject: [PATCH] Distinguish methods from attributes. --- engine/vm.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/engine/vm.c b/engine/vm.c index ba01265..96e9415 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -4593,14 +4593,9 @@ static sxi32 VmByteCodeExec( /* Check if the call is allowed */ pMeth = PH7_ClassExtractMethod(pSelf, pVmFunc->sName.zString, pVmFunc->sName.nByte); if(pMeth && pMeth->iProtection != PH7_CLASS_PROT_PUBLIC) { - if(!VmClassMemberAccess(&(*pVm), pSelf, &pVmFunc->sName, pMeth->iProtection, TRUE)) { - /* Pop given arguments */ - if(pInstr->iP1 > 0) { - VmPopOperand(&pTos, pInstr->iP1); - } - /* Assume a null return value so that the program continue it's execution normally */ - PH7_MemObjRelease(pTos); - break; + if(!VmClassMemberAccess(&(*pVm), pSelf, &pVmFunc->sName, pMeth->iProtection, FALSE)) { + PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, + "Access to the class method '%z->%z()' is forbidden", &pSelf->sName, &pVmFunc->sName); } } }