Skip to content

Commit

Permalink
better fix for #75514
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Nov 28, 2017
1 parent cf08441 commit 2b07102
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/standard/mt_rand.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ PHPAPI zend_long php_mt_rand_range(zend_long min, zend_long max)
* rand() allows min > max, mt_rand does not */
PHPAPI zend_long php_mt_rand_common(zend_long min, zend_long max)
{
uint32_t n;
int64_t n;

if (BG(mt_rand_mode) == MT_RAND_MT19937) {
return php_mt_rand_range(min, max);
}

/* Legacy mode deliberately not inside php_mt_rand_range()
* to prevent other functions being affected */
n = php_mt_rand() >> 1;
n = (int64_t)php_mt_rand() >> 1;
RAND_RANGE_BADSCALING(n, min, max, PHP_MT_RAND_MAX);

return n;
Expand Down

0 comments on commit 2b07102

Please sign in to comment.