Bug #66416 [Opn->Csd]: on PowerPC linux, date() function causes Segmentation fault

From: Date: Wed, 29 Jan 2020 13:04:39 +0000
Subject: Bug #66416 [Opn->Csd]: on PowerPC linux, date() function causes Segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225216@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66416&edit=1 ID: 66416 Updated by: ab@php.net Reported by: lidan at cn dot fujitsu dot com Summary: on PowerPC linux, date() function causes Segmentation fault -Status: Open +Status: Closed Type: Bug Package: Date/time related Operating System: Linux PHP Version: master-Git-2014-01-05 (Git) -Assigned To: +Assigned To: ab Block user comment: N Private report: N New Comment: Not reproducible with latest versions. Please reopen and post a backtrace, if still relevant. Thanks. Previous Comments: ------------------------------------------------------------------------ [2014-01-05 07:40:13] lidan at cn dot fujitsu dot com description updated. ------------------------------------------------------------------------ [2014-01-05 07:32:56] lidan at cn dot fujitsu dot com 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 this bug report at https://bugs.php.net/bug.php?id=66416&edit=1

« previous php.bugs (#225216) next »