]> granicus.if.org Git - php/commitdiff
Check for +/- infinity in base_convert (bug #14807).
authorEdin Kadribasic <edink@php.net>
Tue, 18 Jun 2002 00:04:33 +0000 (00:04 +0000)
committerEdin Kadribasic <edink@php.net>
Tue, 18 Jun 2002 00:04:33 +0000 (00:04 +0000)
ext/standard/math.c

index 4ca710d23566bafc4b96b14588f94cf805e136fc..75eee0dac17bb9dde4c08eb92984168d904cd93b 100644 (file)
@@ -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';