Browse Source

Thoroughly initialize IS_UNUSED for proper cleanup

PHP-4.0.5
Andi Gutmans 26 years ago
parent
commit
30da5fd8fc
  1. 4
      Zend/zend-parser.y
  2. 2
      Zend/zend_compile.c
  3. 9
      Zend/zend_opcode.c

4
Zend/zend-parser.y

@ -497,8 +497,8 @@ function_call:
exit_expr:
/* empty */ { $$.op_type = IS_UNUSED; }
| '(' ')' { $$.op_type = IS_UNUSED; }
/* empty */ { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
| '(' ')' { memset(&$$, 0, sizeof(znode)); $$.op_type = IS_UNUSED; }
| '(' expr ')' { $$ = $2; }
;

2
Zend/zend_compile.c

@ -1183,6 +1183,8 @@ void do_early_binding(CLS_D)
zval_dtor(&opline->op1.u.constant);
zval_dtor(&opline->op2.u.constant);
opline->opcode = ZEND_NOP;
memset(&opline->op1, 0, sizeof(znode));
memset(&opline->op2, 0, sizeof(znode));
SET_UNUSED(opline->op1);
SET_UNUSED(opline->op2);
}

9
Zend/zend_opcode.c

@ -190,12 +190,9 @@ void init_op(zend_op *op CLS_DC)
op->filename = zend_get_compiled_filename(CLS_C);
op->result.op_type = IS_UNUSED;
op->extended_value = 0;
op->op1.u.EA.var = 0;
op->op1.u.EA.type = 0;
op->op2.u.EA.var = 0;
op->op2.u.EA.type = 0;
op->result.u.EA.var = 0;
op->result.u.EA.type = 0;
memset(&op->op1, 0, sizeof(znode));
memset(&op->op2, 0, sizeof(znode));
memset(&op->result, 0, sizeof(znode));
}
zend_op *get_next_op(zend_op_array *op_array CLS_DC)

Loading…
Cancel
Save