]> granicus.if.org Git - php/commitdiff
- MFH
authorDerick Rethans <derick@php.net>
Mon, 24 Jun 2002 08:00:51 +0000 (08:00 +0000)
committerDerick Rethans <derick@php.net>
Mon, 24 Jun 2002 08:00:51 +0000 (08:00 +0000)
ext/standard/math.c

index 4ca710d23566bafc4b96b14588f94cf805e136fc..1f2b0fd2cf4e91ad196e0febeedcd2d37cb69d3b 100644 (file)
@@ -757,7 +757,7 @@ _php_math_longtobase(zval *arg, int base)
  * 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 @@ _php_math_zvaltobase(zval *arg, int base)
                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 @@ PHP_FUNCTION(base_convert)
                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));