php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9323 SIGFPE immediately on startup, dso or cgi
Submitted: 2001-02-17 21:06 UTC Modified: 2001-02-18 05:50 UTC
From: imdave at mcs dot net Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.4pl1 OS: FreeBSD
Private report: No CVE-ID: None
 [2001-02-17 21:06 UTC] imdave at mcs dot net
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-18 05:50 UTC] derick@php.net
Already fixed in CVS. You can use a snapshot from snaps.php.net or use the CVS version.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 22:01:28 2024 UTC