<div dir="ltr"><br><br><div class="gmail_quote">On Wed, Jan 5, 2011 at 1:41 PM, Nadav Har'El <span dir="ltr"><<a href="mailto:nyh@math.technion.ac.il">nyh@math.technion.ac.il</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Wed, Jan 05, 2011, Hetz Ben Hamo wrote about "OT: PHP 32 bit numbers security issue":<br>
</div><div class="im">> Hi,<br>
> I just found something related to PHP and handling 32 bit numbers, I wrote<br>
> about it here: <a href="http://goo.gl/xqQZd" target="_blank">http://goo.gl/xqQZd</a><br>
<br>
</div>I found a fix on Zend's repository,<br>
<a href="http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_strtod.c?r1=307095&r2=307094&pathrev=307095" target="_blank">http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_strtod.c?r1=307095&r2=307094&pathrev=307095</a><br>
<br>
Does anyone know anything about what caused this bug, how come a "volatile"<br>
fixed it (what, it was a gcc optimization bug?), and what does it have to do<br>
with 32 vs 64 bits?<br>
<div class="im"><br><br></div></blockquote><div><br>It has something to do with the precision attempting algorithm of floating point numbers, and the way it is done on fpu87 in 32bit processors. It tries to get close to the number below a certain point which is impossible, and the algorithm does not check to see if it is not actually progressing in getting closer to the minimal precision error. Hence it's an infinite loop. <br>
<br>Compiling with -mfpmath=sse will also solve the problem.<br><br>-- Shimi <br></div></div><br></div>