[xml] core dump buglet in libxml2 when setting new prop



libxml2-2.3.7
-------------

xmlNewNode() -> xmlSetProp() -> xmlNewProp() ->
  xmlEncodeEntitiesReentrant() == CRASH

tree.c
------
xmlSetProp() on a new node (not yet on tree) with a new property calls
xmlNewProp() which does xmlEncodeEntitiesReentrant(doc, value)
here doc is NULL because node has no doc set yet!
This leads to core dump.

I propose:
entities.c
----------
xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input)
-         if ((doc->encoding != NULL) || (html)) {
+         if ( (doc && (doc->encoding != NULL)) || (html)) {

Regards
Jens

-----------------------------------------------------------------------
    Jens Låås                              Email: jens laas data slu se
    Department of Computer Services, SLU   Phone: +46 18 67 35 15
    Vindbrovägen 1                               
    P.O. Box 7079
    S-750 07 Uppsala              
    SWEDEN                      
-----------------------------------------------------------------------





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