From: Edin Kadribasic Date: Tue, 18 Jun 2002 00:04:33 +0000 (+0000) Subject: Check for +/- infinity in base_convert (bug #14807). X-Git-Tag: php-4.3.0dev_zend2_alpha2~216 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb6bcda13b7a4202c7c2419dc28d8042ed82ebe6;p=php Check for +/- infinity in base_convert (bug #14807). --- diff --git a/ext/standard/math.c b/ext/standard/math.c index 4ca710d235..75eee0dac1 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -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';