mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.2'
* PHP-8.2: Fix undefined behaviour in GENERATE_SEED() Fix undefined behaviour when writing 32-bit values in phar/tar.c
This commit is contained in:
commit
0b212ab5ab
2 changed files with 10 additions and 8 deletions
|
@ -65,9 +65,9 @@ PHPAPI double php_combined_lcg(void);
|
|||
(__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
|
||||
|
||||
# ifdef PHP_WIN32
|
||||
# define GENERATE_SEED() (((zend_long) (time(0) * GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
|
||||
# define GENERATE_SEED() (((zend_long) ((zend_ulong) time(NULL) * (zend_ulong) GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
|
||||
# else
|
||||
# define GENERATE_SEED() (((zend_long) (time(0) * getpid())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
|
||||
# define GENERATE_SEED() (((zend_long) ((zend_ulong) time(NULL) * (zend_ulong) getpid())) ^ ((zend_long) (1000000.0 * php_combined_lcg())))
|
||||
# endif
|
||||
|
||||
# define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue