com php-src: Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport: ext/hash/ hash.c ext/hash/php_hash.h
ext/standard/streamsfuncs .c
| From: | Anatol Belski | Date: | Wed, 19 Mar 2014 07:53:59 +0000 |
| Subject: | com php-src: Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport: ext/hash/ hash.c ext/hash/php_hash.h ext/standard/streamsfuncs .c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76531@lists.php.net to get a copy of this message | ||
Commit: 87da8f58e2e6ff1ef2ac1ab68185c263ef023987
Author: Anatol Belski <ab@php.net> Wed, 19 Mar 2014 08:53:59 +0100
Parents: ed70f02b290034b1685bc33e1e5e3cbf10bfec27 c1765d7ffe94fd3278449db7b910cfc9263db13e
Branches: str_size_and_int64_56_backport
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=87da8f58e2e6ff1ef2ac1ab68185c263ef023987
Log:
Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport
* origin/PHP-5.6:
prep for 5.4.27 rc1
remove obsolete comment
Fixes to various stream cast on win64
- Updated to version 2014.1 (2014a)
Add a test
Add hash_equals() to perform string comparisons that are not vulnerable to timing attacks.
Conflicts:
ext/bz2/bz2.c
ext/standard/streamsfuncs.c
Changed paths:
MM ext/hash/hash.c
MM ext/hash/php_hash.h
MM ext/standard/streamsfuncs.c
Diff:
diff --cc ext/hash/php_hash.h
index a497182,c75b930..624dc9c
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.h
@@@ -136,8 -136,9 +136,9 @@@ PHP_FUNCTION(hash_update_file)
PHP_FUNCTION(hash_final);
PHP_FUNCTION(hash_algos);
PHP_FUNCTION(hash_pbkdf2);
+ PHP_FUNCTION(hash_equals);
-PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len);
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, php_size_t algo_len);
PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops);
PHP_HASH_API int php_hash_copy(const void *ops, void *orig_context, void *dest_context);
diff --cc ext/standard/streamsfuncs.c
index c45614a,8d42a51..efd53a3
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@@ -658,12 -653,9 +653,9 @@@ static int stream_array_from_fd_set(zva
int type;
char *key;
- uint key_len;
- ulong num_ind;
+ php_size_t key_len;
+ zend_uint_t num_ind;
- /* Temporary int fd is needed for the STREAM data type on windows, passing this_fd directly to
php_stream_cast()
- would eventually bring a wrong result on x64. php_stream_cast() casts to int internally, and
this will leave
- the higher bits of a SOCKET variable uninitialized on systems with little endian. */
- php_socket_t tmp_fd;
+ php_socket_t this_fd;
type = zend_hash_get_current_key_ex(Z_ARRVAL_P(stream_array),
@@@ -682,12 -674,9 +674,9 @@@
* when casting. It is only used here so that the buffered data warning
* is not displayed.
*/
- if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
(void*)&tmp_fd, 1) && tmp_fd != SOCK_ERR) {
-
- php_socket_t this_fd = (php_socket_t)tmp_fd;
-
+ if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
(void*)&this_fd, 1) && this_fd != SOCK_ERR) {
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
- if (type == HASH_KEY_IS_LONG) {
+ if (type == HASH_KEY_IS_INT) {
zend_hash_index_update(new_hash, num_ind, (void *)elem, sizeof(zval *), (void
**)&dest_elem);
} else { /* HASH_KEY_IS_STRING */
zend_hash_update(new_hash, key, key_len, (void *)elem, sizeof(zval *), (void
**)&dest_elem);