Browse Source

Fix static variables. Now access to non-initialized arrays member does not result in segmentation fault.

pull/50/head
Rafal Kupiec 2 years ago
parent
commit
5d369ba851
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      engine/vm.c

+ 7
- 0
engine/vm.c View File

@ -4858,6 +4858,13 @@ static sxi32 VmByteCodeExec(
if(rc != SXRET_OK) {
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot assign a value of incompatible type to variable '$%z'", &pStatic->sName);
}
} else if(pObj->iFlags & MEMOBJ_HASHMAP) {
ph7_hashmap *pMap;
pMap = PH7_NewHashmap(&(*pVm), 0, 0);
if(pMap == 0) {
PH7_VmMemoryError(&(*pVm));
}
pObj->x.pOther = pMap;
}
pObj->nIdx = pStatic->nIdx;
}


Loading…
Cancel
Save