#47220 [Opn->Csd]: segfault in dom_document_parser in recovery mode
ID: 47220
Updated by: rrichards@php.net
Reported By: felix-php at 7val dot com
-Status: Open
+Status: Closed
Bug Type: DOM XML related
Operating System: Debian Linux
PHP Version: 5.2.8
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-01-26 16:54:42] felix-php at 7val dot com
Description:
------------
A call to DOMDocument::load() or ::loadXML() in recovery mode leads to
segmentation fault in dom_document_parser) when the XML declaration
contains an unknown (and unrecoverable) encoding.
The segfault occurs in document.c +1690 when trying to access
properties of the result document (ret), which is NULL in this case:
if (ret->URL == NULL && ctxt->directory != NULL) {
Reproduce code:
---------------
<?php
$xml = '<?xml version="1.0" encoding="bad"?>';
$dom = new DOMDocument;
$dom->recover = true;
$dom->loadXML($xml);
echo $dom->saveXML();
Expected result:
----------------
<?xml version="1.0"?>
Actual result:
--------------
Segmentation Fault
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47220&edit=1
Thread (2 messages)