mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-15 23:24:06 +03:00
0161e638c6
* parser.c include/libxml/parser.h: completely different fix for the recursion detection based on entity density, big cleanups in the entity parsing code too * result/*.sax*: the parser should not ask for used defined versions of the predefined entities * testrecurse.c: automatic test for entity recursion checks * Makefile.am: added testrecurse * test/recurse/lol* test/recurse/good*: a first set of tests for the recursion Daniel svn path=/trunk/; revision=3783
17 lines
485 B
Diff
17 lines
485 B
Diff
Index: parser.c
|
|
===================================================================
|
|
--- parser.c (revision 3773)
|
|
+++ parser.c (working copy)
|
|
@@ -2505,6 +2505,11 @@ xmlStringLenDecodeEntities(xmlParserCtxt
|
|
c = CUR_SCHAR(str, l);
|
|
else
|
|
c = 0;
|
|
+ if ((nbchars > 500000) &&
|
|
+ (ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE)) {
|
|
+ xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
|
|
+ goto int_error;
|
|
+ }
|
|
}
|
|
buffer[nbchars++] = 0;
|
|
return(buffer);
|