cvs: php4 /ext/standard rand.c
| From: | Jeroen van Wolffelaar | Date: | Mon, 03 Sep 2001 01:25:24 +0000 |
| Subject: | cvs: php4 /ext/standard rand.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7162@lists.php.net to get a copy of this message | ||
jeroen Sun Sep 2 21:25:24 2001 EDT
Modified files:
/php4/ext/standard rand.c
Log:
Fix SIGSEGV because HAS_SRAND didn't check wether the entry existed at
all
Index: php4/ext/standard/rand.c
diff -u php4/ext/standard/rand.c:1.33 php4/ext/standard/rand.c:1.34
--- php4/ext/standard/rand.c:1.33 Sun Sep 2 21:09:35 2001
+++ php4/ext/standard/rand.c Sun Sep 2 21:25:24 2001
@@ -18,7 +18,7 @@
| Jeroen van Wolffelaar <jeroen@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: rand.c,v 1.33 2001/09/03 01:09:35 jeroen Exp $ */
+/* $Id: rand.c,v 1.34 2001/09/03 01:25:24 jeroen Exp $ */
#include <stdlib.h>
@@ -36,7 +36,7 @@
/* an ARRAY of POINTERS, not vice versa */
php_randgen_entry *php_randgen_entries[PHP_RAND_NUMRANDS];
-#define PHP_HAS_SRAND(which) (php_randgen_entries[which]->srand)
+#define PHP_HAS_SRAND(which) (php_randgen_entries[which] &&
php_randgen_entries[which]->srand)
#define PHP_SRAND(which,seed) ((*(php_randgen_entries[which]->srand))(seed))
#define PHP_RAND(which) ((*(php_randgen_entries[which]->rand))())
#define PHP_RANDMAX(which) (php_randgen_entries[which]->randmax)
@@ -48,6 +48,8 @@
{
PHP_MINIT(rand_sys)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(rand_mt)(INIT_FUNC_ARGS_PASSTHRU);
+ /* lcg not yet implemented */
+ php_randgen_entries[PHP_RAND_LCG] = NULL;
}
/* TODO: check that this function is called on the start of each script