Skip to content

Commit 5202ba5

Browse files
committed
Fixed possible access to uninitialized data (prevents valgrind issues in Zend/tests/bug70089.phpt)
1 parent fdb0dd9 commit 5202ba5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Zend/zend_vm_def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,6 +4292,8 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
42924292

42934293
if (OP1_TYPE == IS_VAR && UNEXPECTED(varptr == NULL)) {
42944294
zend_throw_error(NULL, "Only variables can be passed by reference");
4295+
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
4296+
ZVAL_UNDEF(arg);
42954297
HANDLE_EXCEPTION();
42964298
}
42974299

Zend/zend_vm_execute.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15248,6 +15248,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND
1524815248

1524915249
if (IS_VAR == IS_VAR && UNEXPECTED(varptr == NULL)) {
1525015250
zend_throw_error(NULL, "Only variables can be passed by reference");
15251+
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
15252+
ZVAL_UNDEF(arg);
1525115253
HANDLE_EXCEPTION();
1525215254
}
1525315255

@@ -28630,6 +28632,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_
2863028632

2863128633
if (IS_CV == IS_VAR && UNEXPECTED(varptr == NULL)) {
2863228634
zend_throw_error(NULL, "Only variables can be passed by reference");
28635+
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
28636+
ZVAL_UNDEF(arg);
2863328637
HANDLE_EXCEPTION();
2863428638
}
2863528639

0 commit comments

Comments
 (0)