cvs: php4 /ext/standard math.c

From: Date: Sun, 05 Aug 2001 14:40:14 +0000
Subject: cvs: php4 /ext/standard math.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6573@lists.php.net to get a copy of this message
stas Sun Aug 5 10:40:14 2001 EDT Modified files: /php4/ext/standard math.c Log: Check that _php_math_basetolong result fits long (by request from Troels Arvin) Index: php4/ext/standard/math.c diff -u php4/ext/standard/math.c:1.50 php4/ext/standard/math.c:1.51 --- php4/ext/standard/math.c:1.50 Sat Aug 4 21:42:42 2001 +++ php4/ext/standard/math.c Sun Aug 5 10:40:14 2001 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: math.c,v 1.50 2001/08/05 01:42:42 zeev Exp $ */ +/* $Id: math.c,v 1.51 2001/08/05 14:40:14 stas Exp $ */ #include "php.h" #include "php_math.h" @@ -751,6 +751,10 @@ } 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; }

« previous php.cvs (#6573) next »