mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.0'
* PHP-8.0: Fix use after free on compound division by zero
This commit is contained in:
commit
ce3846cd87
2 changed files with 22 additions and 6 deletions
|
@ -1358,7 +1358,7 @@ ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *o
|
|||
|
||||
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_DIV);
|
||||
|
||||
zval op1_copy, op2_copy;
|
||||
zval result_copy, op1_copy, op2_copy;
|
||||
if (UNEXPECTED(zendi_try_convert_scalar_to_number(op1, &op1_copy) == FAILURE)
|
||||
|| UNEXPECTED(zendi_try_convert_scalar_to_number(op2, &op2_copy) == FAILURE)) {
|
||||
zend_binop_error("/", op1, op2);
|
||||
|
@ -1368,12 +1368,12 @@ ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *o
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
if (result == op1) {
|
||||
zval_ptr_dtor(result);
|
||||
}
|
||||
|
||||
retval = div_function_base(result, &op1_copy, &op2_copy);
|
||||
retval = div_function_base(&result_copy, &op1_copy, &op2_copy);
|
||||
if (retval == SUCCESS) {
|
||||
if (result == op1) {
|
||||
zval_ptr_dtor(result);
|
||||
}
|
||||
ZVAL_COPY_VALUE(result, &result_copy);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue