diff options
author | Stanislav Malyshev <stas@php.net> | 2001-08-05 14:40:14 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2001-08-05 14:40:14 +0000 |
commit | c7d7834a43a779203573580f707b630b055cf4c2 (patch) | |
tree | c4b566caa563a22fde6c13571212d75442deef18 | |
parent | aafdfe82cbcc6a51b4498999f8545d41271ba633 (diff) | |
download | php-git-c7d7834a43a779203573580f707b630b055cf4c2.tar.gz |
Check that _php_math_basetolong result fits long (by request from Troels Arvin)
-rw-r--r-- | ext/standard/math.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; } |