libxml2 r3808 - in trunk: . include/libxml
- From: veillard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxml2 r3808 - in trunk: . include/libxml
- Date: Sun, 18 Jan 2009 14:08:37 +0000 (UTC)
Author: veillard
Date: Sun Jan 18 14:08:36 2009
New Revision: 3808
URL: http://svn.gnome.org/viewvc/libxml2?rev=3808&view=rev
Log:
* include/libxml/parserInternals.h SAX2.c: add a new define
XML_MAX_TEXT_LENGHT limiting the maximum size of a single text
node, the defaultis 10MB and can be removed with the HUGE
parsing option
Daniel
Modified:
trunk/ChangeLog
trunk/SAX2.c
trunk/include/libxml/parserInternals.h
Modified: trunk/SAX2.c
==============================================================================
--- trunk/SAX2.c (original)
+++ trunk/SAX2.c Sun Jan 18 14:08:36 2009
@@ -2461,10 +2461,15 @@
(xmlDictOwns(ctxt->dict, lastChild->content))) {
lastChild->content = xmlStrdup(lastChild->content);
}
+ if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGHT) &&
+ ((ctxt->options & XML_PARSE_HUGE) == 0)) {
+ xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node");
+ return;
+ }
if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len ||
(size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) {
- xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
- return;
+ xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
+ return;
}
if (ctxt->nodelen + len >= ctxt->nodemem) {
xmlChar *newbuf;
Modified: trunk/include/libxml/parserInternals.h
==============================================================================
--- trunk/include/libxml/parserInternals.h (original)
+++ trunk/include/libxml/parserInternals.h Sun Jan 18 14:08:36 2009
@@ -24,18 +24,27 @@
/**
* xmlParserMaxDepth:
*
- * arbitrary depth limit for the XML documents that we allow to
- * process. This is not a limitation of the parser but a safety
- * boundary feature.
+ * arbitrary depth limit for the XML documents that we allow to
+ * process. This is not a limitation of the parser but a safety
+ * boundary feature, use XML_PARSE_HUGE option to override it.
*/
XMLPUBVAR unsigned int xmlParserMaxDepth;
- /**
- * XML_MAX_NAMELEN:
- *
- * Identifiers can be longer, but this will be more costly
- * at runtime.
- */
+/**
+ * XML_MAX_TEXT_LENGHT
+ *
+ * Maximum size allowed for a single text node when building a tree.
+ * This is not a limitation of the parser but a safety boundary feature,
+ * use XML_PARSE_HUGE option to override it.
+ */
+#define XML_MAX_TEXT_LENGHT 10000000
+
+/**
+ * XML_MAX_NAMELEN:
+ *
+ * Identifiers can be longer, but this will be more costly
+ * at runtime.
+ */
#define XML_MAX_NAMELEN 100
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]