Bug #74639 [NEW]: Cloning DatePeriod leads to segfault

From: Date: Tue, 23 May 2017 14:02:48 +0000
Subject: Bug #74639 [NEW]: Cloning DatePeriod leads to segfault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209237@lists.php.net to get a copy of this message
From:             j dot baron at gingco dot net
Operating system: Linux and Windows
PHP version:      7.1.5
Package:          Reproducible crash
Bug Type:         Bug
Bug description:Cloning DatePeriod leads to segfault

Description:
------------
Tested PHP version: 7.1.5 (Windows + Linux), 7.1.0RC6 (Linux),

Configure line (No non-standard extensions):

'./configure'  '--prefix=/home/jost/php/installs/7.1.5'
'--enable-static' '--enable-calendar' '--enable-exif'
'--enable-ftp'
'--with-gettext' '--enable-mbstring' '--with-mcrypt'
'--with-mysqli'
'--enable-pcntl' '--with-pdo-pgsql=/var/lib/postgresql/9.3/'
'--with-pgsql=/var/lib/postgresql/9.3/' '--enable-sysvmsg'
'--enable-sysvsem' '--enable-sysvshm' '--enable-sockets'
'--enable-zip'
'--with-zlib-dir' '--with-pcre-dir' '--with-openssl'
'--with-gd'
'--with-readline' '--with-bz2' '--with-curl'
'--enable-bcmath'
'--enable-maintainer-zts' '--enable-intl' '--enable-debug'
'--disable-maintainer-zts'

php.ini:

Loaded Configuration File => (none)
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)



Test script:
---------------
https://pastebin.com/kP4tRJyt

Expected result:
----------------
No crash.

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x0000000000aca980 in _object_and_properties_init (arg=0x7fffee415600,
class_type=0x0, properties=0x0, __zend_filename=0xbba6e0
"/home/jost/php/php-7.1.5/ext/date/php_date.c", __zend_lineno=2541) at
/home/jost/php/php-7.1.5/Zend/zend_API.c:1273
1273		if (UNEXPECTED(class_type->ce_flags &
(ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)))
{
(gdb) bt
#0  0x0000000000aca980 in _object_and_properties_init
(arg=0x7fffee415600, class_type=0x0, properties=0x0,
__zend_filename=0xbba6e0 "/home/jost/php/php-7.1.5/ext/date/php_date.c",
__zend_lineno=2541) at /home/jost/php/php-7.1.5/Zend/zend_API.c:1273
#1  0x0000000000acab7d in _object_init_ex (arg=0x7fffee415600,
class_type=0x0, __zend_filename=0xbba6e0
"/home/jost/php/php-7.1.5/ext/date/php_date.c", __zend_lineno=2541) at
/home/jost/php/php-7.1.5/Zend/zend_API.c:1310
#2  0x000000000044c6d9 in php_date_instantiate (pce=0x0,
object=0x7fffee415600) at
/home/jost/php/php-7.1.5/ext/date/php_date.c:2541
#3  0x0000000000453f91 in zim_DatePeriod_getStartDate
(execute_data=0x7fffee4159a0, return_value=0x7fffee415600) at
/home/jost/php/php-7.1.5/ext/date/php_date.c:4557
#4  0x0000000000b294f1 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at
/home/jost/php/php-7.1.5/Zend/zend_vm_execute.h:1097
#5  0x0000000000b2788d in execute_ex (ex=0x7fffee415030) at
/home/jost/php/php-7.1.5/Zend/zend_vm_execute.h:429
#6  0x0000000000b2799e in zend_execute (op_array=0x7fffee489000,
return_value=0x0) at
/home/jost/php/php-7.1.5/Zend/zend_vm_execute.h:474
#7  0x0000000000ac49e2 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/jost/php/php-7.1.5/Zend/zend.c:1476
#8  0x0000000000a2a423 in php_execute_script
(primary_file=0x7fffffffca90) at
/home/jost/php/php-7.1.5/main/main.c:2537
#9  0x0000000000bae804 in do_cli (argc=2, argv=0x1539a80) at
/home/jost/php/php-7.1.5/sapi/cli/php_cli.c:993
#10 0x0000000000baf9d7 in main (argc=2, argv=0x1539a80) at
/home/jost/php/php-7.1.5/sapi/cli/php_cli.c:1381


-- 
Edit bug report at https://bugs.php.net/bug.php?id=74639&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74639&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74639&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74639&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74639&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74639&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74639&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74639&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74639&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74639&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74639&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74639&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74639&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74639&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74639&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74639&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74639&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74639&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74639&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74639&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74639&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#209237) next »