PHP :: Bug #41582 :: SimpleXML crashes.
| Bug #41582 | SimpleXML crashes. | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2007-06-04 09:53 UTC | Modified: | 2007-06-26 01:00 UTC |
|
||||||||||
| From: | judas dot iscariote at gmail dot com | Assigned: | dmitry (profile) | |||||||||||
| Status: | No Feedback | Package: | SimpleXML related | |||||||||||
| PHP Version: | 5CVS-2007-06-04 (CVS) | OS: | Any | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2007-06-04 09:53 UTC] judas dot iscariote at gmail dot com
Description:
------------
the following code segafaults.
Reproduce code:
---------------
<?php
$xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?> <collection></collection>');
$xml->movie[]->characters->character[0]->name = 'Miss Coder';
//or crashes too ( same issue)
//$xml->movie[0]->characters->character[]->name = 'Miss Coder';
var_dump($xml->asXml());
?>
Expected result:
----------------
Fatal Error: cannot use [] for reading.
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47237115809024 (LWP 23360)]
0x000000000056e7d0 in sxe_prop_dim_read (object=0xc94dd8, member=0x0, elements=0 '\0', attribs=1 '\001', silent=0 '\0')
at /home/cristian/php5/ext/simplexml/simplexml.c:254
254 if (Z_TYPE_P(member) == IS_LONG) {
....
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2007-06-05 10:03 UTC] tony2001@php.net
[2007-06-06 10:53 UTC] judas dot iscariote at gmail dot com
fix works. but leaks memory in the above situation. $xml = new SimpleXMLElement('<?xml version="1.0" standalone="yes"?> <collection></collection>'); $xml->movie[1]->characters->character[]->name = 'Miss Coder'; Zend/zend_execute.c(1249) : Freeing 0x00C97DA0 (24 bytes), script=simplecrashes.php === Total 1 memory leaks detected ===[2007-06-06 11:28 UTC] tony2001@php.net
[2007-06-13 13:53 UTC] dmitry@php.net
[2007-06-15 06:32 UTC] judas dot iscariote at gmail dot com
[2007-06-18 13:39 UTC] nlopess@php.net
[2007-06-18 14:27 UTC] dmitry@php.net
[2007-06-26 01:00 UTC] php-bugs at lists dot php dot net