From fb6bcda13b7a4202c7c2419dc28d8042ed82ebe6 Mon Sep 17 00:00:00 2001 From: Edin Kadribasic Date: Tue, 18 Jun 2002 00:04:33 +0000 Subject: [PATCH] Check for +/- infinity in base_convert (bug #14807). --- ext/standard/math.c | 7 +++++++ 1 file changed, 7 insertions(+) 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'; -- 2.40.0