summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-12-02 12:35:44 +0300
committerDmitry Stogov <dmitry@zend.com>2016-12-02 12:35:44 +0300
commit04500f1fe0106008d9b66f7a11527f45b951c943 (patch)
tree69db08d096373ee21b6c7ade37b5becfcedb8412 /Zend/zend_operators.c
parentad5038bfeef1c6faf1b1971c405d52956bed0208 (diff)
parent67d90a4870499f53faefc3314f50181d4150d7d0 (diff)
downloadphp-git-04500f1fe0106008d9b66f7a11527f45b951c943.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed possible memory leak in &=, |=, ^=.
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r--Zend/zend_operators.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 4159e43e53..beb153c978 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1363,6 +1363,9 @@ ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op
if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) {
if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) {
zend_uchar or = (zend_uchar) (*Z_STRVAL_P(op1) | *Z_STRVAL_P(op2));
+ if (result==op1) {
+ zend_string_release(Z_STR_P(result));
+ }
if (CG(one_char_string)[or]) {
ZVAL_INTERNED_STR(result, CG(one_char_string)[or]);
} else {
@@ -1430,6 +1433,9 @@ ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *o
if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) {
if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) {
zend_uchar and = (zend_uchar) (*Z_STRVAL_P(op1) & *Z_STRVAL_P(op2));
+ if (result==op1) {
+ zend_string_release(Z_STR_P(result));
+ }
if (CG(one_char_string)[and]) {
ZVAL_INTERNED_STR(result, CG(one_char_string)[and]);
} else {
@@ -1497,6 +1503,9 @@ ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *o
if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) {
if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) {
zend_uchar xor = (zend_uchar) (*Z_STRVAL_P(op1) ^ *Z_STRVAL_P(op2));
+ if (result==op1) {
+ zend_string_release(Z_STR_P(result));
+ }
if (CG(one_char_string)[xor]) {
ZVAL_INTERNED_STR(result, CG(one_char_string)[xor]);
} else {