summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2001-08-05 14:40:14 +0000
committerStanislav Malyshev <stas@php.net>2001-08-05 14:40:14 +0000
commitc7d7834a43a779203573580f707b630b055cf4c2 (patch)
treec4b566caa563a22fde6c13571212d75442deef18
parentaafdfe82cbcc6a51b4498999f8545d41271ba633 (diff)
downloadphp-git-c7d7834a43a779203573580f707b630b055cf4c2.tar.gz
Check that _php_math_basetolong result fits long (by request from Troels Arvin)
-rw-r--r--ext/standard/math.c4
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;
}