Bug #74639 [Opn->Csd]: Cloning DatePeriod leads to segfault

From: Date: Thu, 01 Jun 2017 07:08:12 +0000
Subject: Bug #74639 [Opn->Csd]: Cloning DatePeriod leads to segfault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209332@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74639&edit=1

 ID:                 74639
 Updated by:         krakjoe@php.net
 Reported by:        j dot baron at gingco dot net
 Summary:            Cloning DatePeriod leads to segfault
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Reproducible crash
 Operating System:   Linux and Windows
 PHP Version:        7.1.5
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of andrew.nester.dev@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=48598a23024eb587127b59bf0490891addfc41ed
Log: Fixed #74639 - Added proper clone functionality for DatePeriod and DateInterval


Previous Comments:
------------------------------------------------------------------------
[2017-05-26 12:47:01] cmb@php.net

Related to bug #50559.

------------------------------------------------------------------------
[2017-05-26 10:59:51] andrew dot nester dot dev at gmail dot com

Thanks for reporting this issue.
I've just added PR implementing proper cloning logic.

------------------------------------------------------------------------
[2017-05-23 14:02:35] j dot baron at gingco dot net

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 this bug report at https://bugs.php.net/bug.php?id=74639&edit=1


Thread (4 messages)

« previous php.bugs (#209332) next »