com php-src: Fixed crash in Zend/tests/bug69891.phpt on x86 (32-bit). compare_function() now has to be compatible w ith binary_op_type (use fastcall
convention). Introduced new zval_compare_function() to be used as zval comparison callback instead of co mpare_function().: Zend/zend_operators.c
Zend /zend_operators.h ext/standard/array.c
| From: | Dmitry Stogov | Date: | Mon, 22 Jun 2015 09:53:52 +0000 |
| Subject: | com php-src: Fixed crash in Zend/tests/bug69891.phpt on x86 (32-bit). compare_function() now has to be compatible w ith binary_op_type (use fastcall convention). Introduced new zval_compare_function() to be used as zval comparison callback instead of co mpare_function().: Zend/zend_operators.c Zend /zend_operators.h ext/standard/array.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87436@lists.php.net to get a copy of this message | ||
Commit: b97df475dfbfe5c7ddd883432eb3bcf3645803e9
Author: Dmitry Stogov <dmitry@zend.com> Mon, 22 Jun 2015 12:53:52 +0300
Parents: 0da4c34f0e5957f4370a22bfcc0043efb1f59955
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b97df475dfbfe5c7ddd883432eb3bcf3645803e9
Log:
Fixed crash in Zend/tests/bug69891.phpt on x86 (32-bit).
compare_function() now has to be compatible with binary_op_type (use fastcall convention).
Introduced new zval_compare_function() to be used as zval comparison callback instead of
compare_function().
Bugs:
https://bugs.php.net/69891
Changed paths:
M Zend/zend_operators.c
M Zend/zend_operators.h
M ext/standard/array.c
Diff:
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 7e3b458..2658474 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1760,7 +1760,7 @@ static inline void zend_free_obj_get_result(zval *op) /* {{{ */
}
/* }}} */
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
+static zend_always_inline int i_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
int ret;
int converted = 0;
@@ -1942,6 +1942,18 @@ ZEND_API int compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
}
/* }}} */
+ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
+{
+ return i_compare_function(result, op1, op2);
+}
+/* }}} */
+
+ZEND_API int zval_compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
+{
+ return i_compare_function(result, op1, op2);
+}
+/* }}} */
+
static int hash_zval_identical_function(zval *z1, zval *z2) /* {{{ */
{
zval result;
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index 17d1bcf..601508c 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -327,7 +327,8 @@ again:
return result;
}
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2);
+ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2);
+ZEND_API int zval_compare_function(zval *result, zval *op1, zval *op2);
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2);
ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool
case_insensitive);
ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2);
diff --git a/ext/standard/array.c b/ext/standard/array.c
index fdfb910..a998079 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -164,7 +164,7 @@ static void php_set_compare_func(zend_long sort_type) /* {{{ */
case PHP_SORT_REGULAR:
default:
- ARRAYG(compare_func) = compare_function;
+ ARRAYG(compare_func) = zval_compare_function;
break;
}
}