Re: [xml] xmlNodeDumpOutput appears to corrupt data; crash follows in xmlStrEqual



At 01:43 PM 1/8/2003 -0500, Daniel Veillard wrote:
  I'm very sorry, but I do not have the time to fix the PHP code.
Your documents from your example did NOT have any DOCTYPE. The doc
xmlDocPtr passed to the serialization routine had an xmlDtdNode.
That xmlDtdNode will NOT be generated by libxml2 (any version) when
passing the sample examples your provided within your PHP. Moreover
that xmlDtdNode is buggy because one of the pointers is 0x3 which
leads to the crash. I don't have the time to find in the PHP code
  - what code generated that xmlDtdNode.
  - why it has buggy pointers
  - why it's passed to the serialization routine while
    obviously the document asked for serialization should NOT
    have an xmlDtdNode

 Again I can't debug this. This sounds completely broken to stay polite.
The fact that the bug doesn't show up with other versions is simply that
earlier version don't have the XHTML1 detection code looking for the
DTD System ID in order to adjust the serializations accordingly.

Thank you very much.
I have never debugged PHP sources either but looking in <php_source>/ext/domxml.c I found this:
The "FIX ME" comment seems to suggest a problem :--)

[ ... omitted stuff ...]

PHPAPI zval *php_domobject_new(xmlNodePtr obj, int *found, zval *wrapper_in TSRMLS_DC)
{

[ ... omitted stuff ...]

/* FIXME: nodes of type XML_DTD_NODE used to be domxmldtd_class_entry. * but the DOM Standard doesn't have a DomDtd class. The DocumentType * class seems to be want we need and the libxml dtd functions are * very much like the methods of DocumentType. I wonder what exactly * is the difference between XML_DTD_NODE and XML_DOCUMENT_TYPE_NODE.
                 * Something like
* <!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
                 * [ <!ENTITY sp \"spanish\">
                 * ]>
* is considered a DTD by libxml, but from the DOM perspective it
                 * rather is a DocumentType
                 */
                case XML_DTD_NODE:
                case XML_DOCUMENT_TYPE_NODE:
                {
                        xmlDtdPtr dtd = (xmlDtdPtr) obj;
                        if(!wrapper_in)
object_init_ex(wrapper, domxmldoctype_class_entry);
/*                      rsrc_type = le_domxmldtdp; */
                        rsrc_type = le_domxmldoctypep;
/*                      add_property_long(wrapper, "type", Z_TYPE_P(dtd)); */
add_property_long(wrapper, "type", XML_DOCUMENT_TYPE_NODE);
                        if (dtd->ExternalID)
add_property_string(wrapper, "publicId", (char *) dtd->ExternalID, 1);
                        else
add_property_string(wrapper, "publicId", "", 1);
                        if (dtd->SystemID)
add_property_string(wrapper, "systemId", (char *) dtd->SystemID, 1);
                        else
add_property_string(wrapper, "systemId", "", 1);
                        if (dtd->name)
add_property_string(wrapper, "name", (char *) dtd->name, 1);
                        break;
                }



- Greg Keraunen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]