diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2016-12-02 12:36:02 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2016-12-02 12:36:02 +0300 |
| commit | 0ce5f99caf6391c967f78e9e2d35bb7395217128 (patch) | |
| tree | 36d8f72502492b0a623fbc96838ffbba4c066127 /Zend/zend_operators.c | |
| parent | 22cebaf89a2e3ec9ca798961badbe53331c570f7 (diff) | |
| parent | 04500f1fe0106008d9b66f7a11527f45b951c943 (diff) | |
| download | php-git-0ce5f99caf6391c967f78e9e2d35bb7395217128.tar.gz | |
Merge branch 'PHP-7.1'
* PHP-7.1:
Fixed possible memory leak in &=, |=, ^=.
Diffstat (limited to 'Zend/zend_operators.c')
| -rw-r--r-- | Zend/zend_operators.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 8005577694..de0c19e94f 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1344,6 +1344,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 { @@ -1411,6 +1414,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 { @@ -1478,6 +1484,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 { |
