From: Stanislav Malyshev Date: Sun, 5 Aug 2001 14:40:14 +0000 (+0000) Subject: Check that _php_math_basetolong result fits long (by request from Troels Arvin) X-Git-Tag: PRE_ENGINE2_SPLIT~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7d7834a43a779203573580f707b630b055cf4c2;p=php Check that _php_math_basetolong result fits long (by request from Troels Arvin) --- diff --git a/ext/standard/math.c b/ext/standard/math.c index bfdade04ca..89c529623c 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -752,6 +752,10 @@ _php_math_basetolong(zval *arg, int base) { if (digit >= base) { continue; } + if(!mult || digit > LONG_MAX/mult || num > LONG_MAX-mult*digit) { + php_error(E_WARNING, "base_to_long: number '%s' is too big to fit in long", s); + return LONG_MAX; + } num += mult * digit; }