1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00

Check that _php_math_basetolong result fits long (by request from Troels Arvin)

This commit is contained in:
Stanislav Malyshev
2001-08-05 14:40:14 +00:00
parent aafdfe82cb
commit c7d7834a43
+4
View File
@@ -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;
}