Always pop the l-value on variable declaration.
已通過所有檢查
The build was successful.

Otherwise, it might lead to unexpected behaviour including protected memory access and segmentation fault.
This finally fixes #49.
This commit is contained in:
Piotr Likoski 2019-04-16 20:15:38 +02:00
父節點 a5da714d61
當前提交 6b18e204cd
沒有發現已知的金鑰在資料庫的簽署中
GPG 金鑰 ID: D9556DDD74910B18

查看文件

@ -2555,6 +2555,8 @@ static sxi32 PH7_CompileVar(ph7_gen_state *pGen) {
void *p3 = (void *) zDup;
/* Emit OP_DECLARE instruction */
PH7_VmEmitInstr(pGen->pVm, pGen->pIn->nLine, PH7_OP_DECLARE, 0, nType, p3, 0);
/* Pop the l-value */
PH7_VmEmitInstr(pGen->pVm, nLine, PH7_OP_POP, 1, 0, 0, 0);
/* Check if we have an expression to compile */
if(pGen->pIn < pGen->pEnd && (pGen->pIn[2].nType & PH7_TK_EQUAL)) {
/* Compile the expression */