Bug #66416 [NEW]: on PowerPC linux, date() functions calls Segmentation fault
| From: | lidan at cn dot fujitsu dot com | Date: | Sun, 05 Jan 2014 07:32:57 +0000 |
| Subject: | Bug #66416 [NEW]: on PowerPC linux, date() functions calls Segmentation fault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183594@lists.php.net to get a copy of this message | ||
From: lidan at cn dot fujitsu dot com
Operating system: Linux
PHP version: master-Git-2014-01-05 (Git)
Package: Date/time related
Bug Type: Bug
Bug description:on PowerPC linux, date() functions calls Segmentation fault
Description:
------------
OS: linux 3.0.8
Arch:PowerPC
PHP version: 5.5.7
configure:
./configure --host=powerpc-linux --disable-all
CC=powerpc-e500v2-linux-gnuspe-gcc
Problem:
on x86 it is OK. But, on PowerPC it caused segmentation fault.
1.$./sapi/cli/php -r 'date("Y");'
Segmentation Fault
It is because in ext/date/lib/parse_tz.c Line 35:
#if (defined(__APPLE__) || defined(__APPLE_CC__)) &&
(defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
# if defined(__LITTLE_ENDIAN__)
# undef WORDS_BIGENDIAN
# else
# if defined(__BIG_ENDIAN__)
# define WORDS_BIGENDIAN
# endif
PowerPC is big endian, so __BIG_ENDIAN__ is defined. But __APPLE__ or
__APPLE_CC__ is not defined. In result, WORD_BIGENDIAN is not defined.
So, in line 45, timelib_conv_int() used the little endian version. The
segmentation fault is caused.
#ifdef WORDS_BIGENDIAN
#define timelib_conv_int(l) (l)
#else
#define timelib_conv_int(l) ((l & 0x000000ff) << 24) + ((l & 0x0000ff00)
<< + ((l & 0x00ff0000) >> 8) + ((l & 0xff000000) >> 24)
#endif
Test script:
---------------
./sapi/cli/php -r 'date("Y");'
Expected result:
----------------
2014
Actual result:
--------------
Segmentation Fault
--
Edit bug report at https://bugs.php.net/bug.php?id=66416&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66416&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66416&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66416&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66416&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66416&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66416&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66416&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66416&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66416&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66416&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66416&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66416&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66416&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66416&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66416&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66416&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66416&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66416&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66416&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66416&r=mysqlcfg