Re: com php-src: Fix legacy mode RAND_RANGE and 32/64-bit consistency: ext/standard/mt_rand.c ext/standard/php_rand.h
| From: | Leigh | Date: | Sat, 06 Aug 2016 10:22:42 +0000 |
| Subject: | Re: com php-src: Fix legacy mode RAND_RANGE and 32/64-bit consistency: ext/standard/mt_rand.c ext/standard/php_rand.h | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-93644@lists.php.net to get a copy of this message | ||
On Wed, 3 Aug 2016 at 13:12 Remi Collet <remi@php.net> wrote:
> Le 16/07/2016 à 18:50, Leigh a écrit :
> > Commit: 027375d4c3a59b0f174b1beb70ba8f60efef6905
> > Author: Leigh <leigh@php.net> Sat, 16 Jul 2016 16:50:20 +0000
> > Parents: be3640150cb2f88d38a8d405b2bf708f04be39ef
> > Branches: master
> >
> > Link:
>
> http://git.php.net/?p=php-src.git;a=commitdiff;h=027375d4c3a59b0f174b1beb70ba8f60efef6905
> >
> > Log:
> > Fix legacy mode RAND_RANGE and 32/64-bit consistency
>
> This breaks on 32bits, php hangs
> (ext/standard/tests/math/mt_rand_variation2.phpt)
>
> From trace, result grow and is stay > limit.
> while (UNEXPECTED(result > limit)) {
> printf("%lu > %lu\n", result, limit);
> result = (result << 32) | php_mt_rand();
> }
>
> 2705857063 > 2147495992
> 2717777703 > 2147495992
> 3053322047 > 2147495992
> 3221094335 > 2147495992
> 4294967295 > 2147495992
> 4294967295 > 2147495992
> 4294967295 > 2147495992
> 4294967295 > 2147495992
> ...
>
>
> Can you please have a look, perhaps better to revert
> (even if this keep a inconsistency between 32 and 64bits) ?
>
>
> Remi.
>
I saw you already reverted this, I have pushed another fix that should keep
platform consistency, and also not break on 32 bit.
Commit 5bf39267eec42a76334ce0afdfaa3b28a7f222cd