Re: Zend engine bug
| From: | Zeev Suraski | Date: | Wed, 05 Sep 2001 16:28:32 +0000 |
| Subject: | Re: Zend engine bug | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-65164@lists.php.net to get a copy of this message | ||
This piece of code is pretty new; It was written in that way to make it possible to store IPs.
In what cases do you see a problem with that? If (d) is bigger than LONG_MAX, than you're screwed anyway.
Zeev
At 19:20 05-09-01, Gavin Sherry wrote:
Hi guys, Just looking through some older bugs. #13007 is a bug in the Zend engine. The problem is the zval.value.lval is overflowing. The zendi_convert_to_long() macro converts doubles to unsigned long ints as follows: (l) = (d) > LONG_MAX ? (unsigned long) (d) : (long) (d); It cannot do this since l (zval.value.lval) is signed. This also means that other functions using using zendi_convert_to_long() are busted: modulus and rest of the bitwise implementation. What's the solution? Well, certainly not to make lval unsigned or use long long (since some platforms do not support). The main issue is that due to the way variables in PHP are initialised, users are given the impression that integer variables have no maximum sizes. By the same token, it makes no sense to limit bitwise and mod operations to numbers under LONG_MAX. The easiest hack would be to promote the type of the other value to double and return that as the result. But will this break anything? Gavin -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net