PHP 4.0 Bug #9323: SIGFPE immediately on startup, dso or cgi

From: Date: Sun, 18 Feb 2001 02:06:11 +0000
Subject: PHP 4.0 Bug #9323: SIGFPE immediately on startup, dso or cgi
Groups: php.dev 
Request: Send a blank email to php-dev+get-46817@lists.php.net to get a copy of this message
From: imdave@mcs.net Operating system: FreeBSD PHP version: 4.0.4pl1 PHP Bug Type: Reproduceable crash Bug description: SIGFPE immediately on startup, dso or cgi Built on an old release of FreeBSD (2.2.5). I think that current releases might mask most FPE exceptions by default, but I do not know that for sure. I also think that Linux masks all exceptions also, so the bug is concealed on those systems. I tracked the problem down to ext/standard/crypt.c, the line: srand48((unsigned int) time(0) * getpid() * (php_combined_lcg() * 10000.0)); Sorry, I no longer have the buggy version built so I can't get you a gdb backtrace. However, the problem is simply that the double result is too large to fit in a 32-bit integer and the SIGFPE occurs. Note that even if one masks the exception, there is still the problem that the result will then become zero (see the intel x86 documentation) -- not a very good thing to seed a random number generator with. As a quick fix, I just changed the line to: srand48((unsigned int) time(0) * getpid()); since integer overflow doesn't cause an exception. Note that this bug is probably related to #9106. -- Edit Bug report at: http://bugs.php.net/?id=9323&edit=1

« previous php.dev (#46817) next »