]> granicus.if.org Git - php/commitdiff
Minor revert of be3640150cb2f88d38a8d405b2bf708f04be39ef
authorRemi Collet <remi@php.net>
Wed, 3 Aug 2016 12:27:46 +0000 (14:27 +0200)
committerRemi Collet <remi@php.net>
Wed, 3 Aug 2016 12:27:46 +0000 (14:27 +0200)
On 32bits this may cause php to hangs forever.

ext/standard/mt_rand.c

index bf9ce66f652b2ae81bcb64d51c49e53073f83bed..2be8d5d07571585dc539b8de83c0f155b4e4ebfc 100644 (file)
@@ -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
                }
        }