Bug #62500 [Opn->Csd]: Segfault in DateInterval class when extended
| From: | laruence@php.net | Date: | Sun, 08 Jul 2012 16:29:01 +0000 |
| Subject: | Bug #62500 [Opn->Csd]: Segfault in DateInterval class when extended | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171802@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62500&edit=1
ID: 62500
Updated by: laruence@php.net
Reported by: rik at c-ict dot com
Summary: Segfault in DateInterval class when extended
-Status: Open
+Status: Closed
Type: Bug
Package: Reproducible crash
Operating System: At least Linux
PHP Version: 5.4.4
-Assigned To:
+Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2012-07-08 16:28:00] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3b9b1e6dc016d9128ac5e9ed95aa5b1a5065e5f
Log: Fixed Bug #62500 (Segfault in DateInterval class when extended)
------------------------------------------------------------------------
[2012-07-08 16:26:27] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e3b9b1e6dc016d9128ac5e9ed95aa5b1a5065e5f
Log: Fixed Bug #62500 (Segfault in DateInterval class when extended)
------------------------------------------------------------------------
[2012-07-08 08:19:10] reeze dot xia at gmail dot com
It missing a initialized checking when accessing member variable.
I've sent a patch here: https://github.com/php/php-src/pull/123
------------------------------------------------------------------------
[2012-07-07 16:00:14] rik at c-ict dot com
Also a short note,
This problem can be worked around by calling the parent constructor before accessing any members.
------------------------------------------------------------------------
[2012-07-07 15:53:59] rik at c-ict dot com
Description:
------------
Hello,
I found a way to reproduce a segfault on at least linux but possibly on other OS'es as wel.
It is very simple to reproduce:
1 overload the DateInterval in a new class.
2 overload the constructor
3 use one of the member variables.
[Sat Jul 07 17:46:32 2012] [notice] child pid 5775 exit signal Segmentation fault (11)
I tested with PHP 5.4.4 and it is there, but it also exists in PHP 5.3
Test script:
---------------
<?php
class Crasher extends DateInterval {
public function __construct($time_spec) {
echo "Yes i did it, with the next statement it gives a segfault\n";
// It doesn't matter if we take the y parameter or any other.
$this->y = 3;
}
}
$c = new Crasher('blah');
?>
Expected result:
----------------
Yes i did it, with the next statement it gives a segfault
Segmentation fault
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62500&edit=1