diff options
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r-- | Zend/zend_operators.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 921d71b685..7d591f52ef 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1493,6 +1493,12 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) / op1_lval = Z_LVAL_P(op1); } + if (Z_LVAL_P(op2) < 0) { + zend_error(E_WARNING, "Bit shift by negative number"); + ZVAL_FALSE(result); + return FAILURE; + } + ZVAL_LONG(result, op1_lval << Z_LVAL_P(op2)); return SUCCESS; } @@ -1513,6 +1519,12 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) op1_lval = Z_LVAL_P(op1); } + if (Z_LVAL_P(op2) < 0) { + zend_error(E_WARNING, "Bit shift by negative number"); + ZVAL_FALSE(result); + return FAILURE; + } + ZVAL_LONG(result, op1_lval >> Z_LVAL_P(op2)); return SUCCESS; } |