Files
main/programming/php/php/files/int_overflow_in_mt_rand.patch
T
2019-08-05 18:25:07 +03:00

15 lines
488 B
Diff

--- php-5.2.14.orig/ext/standard/rand.c 2011-02-07 14:44:55.975000003 +0200
+++ php-5.2.14/ext/standard/rand.c 2011-02-07 16:24:24.017000004 +0200
@@ -322,6 +322,11 @@
php_mt_srand(GENERATE_SEED() TSRMLS_CC);
}
+ if (max < min) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(%d) is smaller than min(%d)", max, min);
+ RETURN_FALSE;
+ }
+
/*
* Melo: hmms.. randomMT() returns 32 random bits...
* Yet, the previous php_rand only returns 31 at most.