From:             [EMAIL PROTECTED]
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



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to