#33227 [Com]: zend_strtod() broken on big-endian arm
| From: | terry dot s dot duncan at intel dot com | Date: | Tue, 23 Jan 2007 01:29:44 +0000 |
| Subject: | #33227 [Com]: zend_strtod() broken on big-endian arm | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-107917@lists.php.net to get a copy of this message | ||
ID: 33227
Comment by: terry dot s dot duncan at intel dot com
Reported By: jbparsons at ucdavis dot edu
Status: No Feedback
Bug Type: Reproducible crash
Operating System: "unslung" - www.nslu2-linux.org
PHP Version: 5.0.4
New Comment:
Lines 126-133 indicate that the CPU is little endian. Not necessarily
true. The CPU can be configured either way. If configured BE, the
Storeinc() macro is not correct. I ran into this using unserialize()
with this value... d:134.11045074462890625
Previous Comments:
------------------------------------------------------------------------
[2005-06-11 01:00:03] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2005-06-03 08:05:58] sniper@php.net
See lines 126-133 in zend_strtod.c
------------------------------------------------------------------------
[2005-06-03 03:44:43] jbparsons at ucdavis dot edu
Description:
------------
On big-endian arm systems, php sometimes crashes (infinite loop) inside
zend_strtod().
The problem seems to be the code at line 261 of zend_strtod.c, which
apparently assumes that every arm system has little-endian integers:
#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm__)
#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b,
\
((unsigned short *)a)[0] = (unsigned short)c, a++)
#else
#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b,
\
((unsigned short *)a)[1] = (unsigned short)c, a++)
#endif
Reproduce code:
---------------
<?php
echo "start";
if ("79e88e6db0c25ca1ee5e2aac35a24d6c"
== "79e88e6db0c25ca1ee5e2aac35a24d6c")
{
echo "passed";
}
echo "end";
?>
Expected result:
----------------
startend
Actual result:
--------------
(gdb) run
Starting program: /share/hdd/data/home/jp30/t/php foo.php
start
[...minutes pass, then Ctrl-C is pressed...]
Program received signal SIGINT, Interrupt.
0x00146528 in zend_strtod ()
(gdb) bt
#0 0x00146528 in zend_strtod ()
Cannot access memory at address 0x4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33227&edit=1