com php-src: Minor revert of be3640150cb2f88d38a8d405b2bf708f04be39ef: ext/standard/mt_rand.c
| From: | Remi Collet | Date: | Wed, 03 Aug 2016 12:27:46 +0000 |
| Subject: | com php-src: Minor revert of be3640150cb2f88d38a8d405b2bf708f04be39ef: ext/standard/mt_rand.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93564@lists.php.net to get a copy of this message | ||
Commit: f9ce8aa75bf549fc1f22dbe75dc737b6a3e0d24f
Author: Remi Collet <remi@php.net> Wed, 3 Aug 2016 14:27:46 +0200
Parents: a70ca97c189e5ccf931a4fa6dd4186a0d6cd3e14
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f9ce8aa75bf549fc1f22dbe75dc737b6a3e0d24f
Log:
Minor revert of be3640150cb2f88d38a8d405b2bf708f04be39ef
On 32bits this may cause php to hangs forever.
Changed paths:
M ext/standard/mt_rand.c
Diff:
diff --git a/ext/standard/mt_rand.c b/ext/standard/mt_rand.c
index bf9ce66..2be8d5d 100644
--- a/ext/standard/mt_rand.c
+++ b/ext/standard/mt_rand.c
@@ -237,7 +237,11 @@ PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max)
/* Discard numbers over the limit to avoid modulo bias */
while (UNEXPECTED(result > limit)) {
+#if ZEND_ULONG_MAX > UINT32_MAX
result = (result << 32) | php_mt_rand();
+#else
+ result = php_mt_rand();
+#endif
}
}