|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57830 wrong storage class for variable in C function gsrgs()
Submitted: 2007-09-09 08:04 UTC Modified: -
From: hans at origin dot edvz dot uni-linz dot ac dot at Assigned:
Status: Open Package: stats (PECL)
PHP Version: 4.4.5 OS: Linux
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-09-09 08:04 UTC] hans at origin dot edvz dot uni-linz dot ac dot at
in the sources of the PECL extension stats 1.0.2 we
need a 'static' storage class for the variable qinit:

File: stats-1.0.2/randlib.c
Function: void gsrgs(long getset,long *qvalue)

Original Code:
long qinit = 0;

Fixed Code:
/*MeJ: use static storage class ... otherwise 
       the value assigned to qinit gets lost upon
       return from function gsrgs()
static long qinit = 0;

Reproduce code:
stats_rand_setall ( 4711, 88888);
$val = stats_rand_gen_gamma ( 0.6, 0.1 );

Expected result:
$val should be assigned a random float value 

Actual result:
X-Powered-By: PHP/4.4.5
Content-type: text/html

 INITGN called before random number generator  initialized -- abort!


fix_randlib.c_add_static (last revision 2013-11-01 10:09 UTC) by dev at example dot org)

Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Mon Apr 21 14:02:18 2014 UTC