cvs: php4(PHP_4_2_0) /ext/standard math.c
| From: | Derick Rethans | Date: | Mon, 24 Jun 2002 08:00:54 +0000 |
| Subject: | cvs: php4(PHP_4_2_0) /ext/standard math.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12478@lists.php.net to get a copy of this message | ||
derick Mon Jun 24 04:00:54 2002 EDT
Modified files: (Branch: PHP_4_2_0)
/php4/ext/standard math.c
Log:
- MFH
Index: php4/ext/standard/math.c
diff -u php4/ext/standard/math.c:1.80.2.2 php4/ext/standard/math.c:1.80.2.3
--- php4/ext/standard/math.c:1.80.2.2 Thu May 23 10:38:08 2002
+++ php4/ext/standard/math.c Mon Jun 24 04:00:51 2002
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.80.2.2 2002/05/23 14:38:08 edink Exp $ */
+/* $Id: math.c,v 1.80.2.3 2002/06/24 08:00:51 derick Exp $ */
#include "php.h"
#include "php_math.h"
@@ -757,7 +757,7 @@
* the number.
*/
PHPAPI char *
-_php_math_zvaltobase(zval *arg, int base)
+_php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
{
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
@@ -770,6 +770,13 @@
char *ptr, *end;
char buf[(sizeof(double) << 3) + 1];
+ /* Don't try to convert +/- infinity */
+ if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) {
+ php_error(E_WARNING, "Number too large in %s() call",
+ get_active_function_name(TSRMLS_C));
+ return empty_string;
+ }
+
end = ptr = buf + sizeof(buf) - 1;
*ptr = '\0';
@@ -927,7 +934,7 @@
RETURN_FALSE;
}
- if(_php_math_basetozval(*number, Z_LVAL_PP(frombase), &temp) != SUCCESS) {
+ if(_php_math_basetozval(*number, Z_LVAL_PP(frombase), &temp TSRMLS_CC) != SUCCESS) {
RETURN_FALSE;
}
result = _php_math_zvaltobase(&temp, Z_LVAL_PP(tobase));