mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Prevent bit shift count wrapping quirkiness on some CPUs for left shift
This commit is contained in:
parent
cb770cdc03
commit
b3ba0f6ab0
@ -1493,6 +1493,12 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
|
||||
op1_lval = Z_LVAL_P(op1);
|
||||
}
|
||||
|
||||
/* prevent wrapping quirkiness on some processors where << 64 + x == << x */
|
||||
if (Z_LVAL_P(op2) >= SIZEOF_LONG * 8) {
|
||||
ZVAL_LONG(result, 0);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (Z_LVAL_P(op2) < 0) {
|
||||
zend_error(E_WARNING, "Bit shift by negative number");
|
||||
ZVAL_FALSE(result);
|
||||
|
Loading…
Reference in New Issue
Block a user