Segfault patch

From: Date: Fri, 14 Apr 2000 16:12:47 +0000
Subject: Segfault patch
Groups: php.dev 
Request: Send a blank email to php-dev+get-17916@lists.php.net to get a copy of this message
PHP 4.0RC1 (and 3.0.15) segfaults when formatting very big numbers with number_format: $a="1E+32"; print(number_format($a, 2, ",", ".")); Here 1E+32 and anything over makes PHP segfault. The fix: --- ext/standard/math.c.orig Sun Mar 12 18:18:21 2000 +++ ext/standard/math.c Fri Apr 14 17:26:25 2000 @@ -25,6 +25,7 @@ #include "phpmath.h" #include <math.h> +#include <float.h> #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -611,7 +612,7 @@ d = -d; } dec = MAX(0,dec); - tmpbuf = (char *) emalloc(32+dec); + tmpbuf = (char *) emalloc(1 + DBL_MAX_10_EXP + 1 + dec + 1); tmplen=sprintf(tmpbuf,"%.*f",dec,d);

« previous php.dev (#17916) next »