[xml] libxml2 issue with corrupted data



Our product uses libxml2.dll release 2.7.8 and have encountered the following issue:

We receive an XML with a tag “<Tag>” that its value contains non UTF-8 string format. The string format is actually messed up and has no meaning in any format I know. The string hex value is :0xe941e6.

We pass the entire XML to the parser using the method:


XMLPUBFUN int XMLCALL xmlParseChunk (xmlParserCtxtPtr ctxt,

                                    const char *chunk,

                                    int size,

                                    int terminate);


where the ctxt used is a member of a wrapper class and is initiated with an xmlSAXHandler member that has functions set in his startElementSAXFunc startElement &

endElementSAXFunc endElement


when the parser reaches to the <Tag> section than there is a call to startElement however there is no call for the endElement for at least 200 ms. What happens after this 200ms is that a new XML message arrives and our application calls xmlFreeParserCtxt for the ctxt member and call xmlParseChunk again thus losing the info the previous XML (not a good behavior on our side).


However if there is 1000ms delay between the messages than the parser succeeds to parse the XML and there is call to endElement.


Also if the string value in <Tag> is not messed up than the parse calls startElement & endElement within the same millisecond.


Can you please tell me why it takes so long for the parser to handle corrupted data? The parser doesn’t fail to parse but rather takes his time… Is that an expected behavior?






Description: Description: Description: cid:image001.png@01CD4349.3BFD1DD0

Description: Description: Description: Description: Description: image003

Noa Gross Scopia Desktop – SW Engineer |

Video Business Unit 972.3.767.9498 | gidons avaya com

Delivering the Visual Experience™




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