Skip to content

Commit 9944ce3

Browse files
committed
[[ Bug 11903 ]] Use WithOptions variants of libxml SAX functions so that XML data limits can be turned off (XML_PARSE_HUGE).
1 parent 4df76f7 commit 9944ce3

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

docs/notes/bugfix-11903.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Ensure large XML files (those with large text nodes) still parse.

revxml/src/xmldoc.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,15 @@ Bool CXMLDocument::Read(char *data, unsigned long tlength, Bool wellformed)
234234
{
235235
xmlKeepBlanksDefault(0);
236236
Free(); //free document
237-
doc = xmlSAXParseMemory(&SAXHandlerTable, data, tlength, !wellformed);
237+
238+
// MW-2014-03-10: [[ Bug 11903 ]] Use modified libXML functions that allow us to
239+
// pass through XML_PARSE_HUGE (so the new 2.9 limits don't apply!).
240+
int options;
241+
options = XML_PARSE_HUGE;
242+
if (!wellformed)
243+
options |= XML_PARSE_RECOVER;
244+
245+
doc = xmlSAXParseMemoryWithDataAndOptions(&SAXHandlerTable, data, tlength, options, NULL);
238246

239247
// OK-2007-12-17 : Bug 5632. If Validate() is called in this context it crashes
240248
// For now we just remove the validation step from here as it proved difficult to
@@ -250,7 +258,15 @@ Bool CXMLDocument::ReadFile(char *filename, Bool wellformed)
250258
{
251259
xmlKeepBlanksDefault(0);
252260
Free(); //free document
253-
doc = xmlSAXParseFile(&SAXHandlerTable, filename, !wellformed);
261+
262+
// MW-2014-03-10: [[ Bug 11903 ]] Use modified libXML functions that allow us to
263+
// pass through XML_PARSE_HUGE (so the new 2.9 limits don't apply!).
264+
int options;
265+
options = XML_PARSE_HUGE;
266+
if (!wellformed)
267+
options |= XML_PARSE_RECOVER;
268+
269+
doc = xmlSAXParseFileWithDataAndOptions(&SAXHandlerTable, filename, options, NULL);
254270

255271
// OK-2007-12-17 : Bug 5632. If Validate() is called in this context it crashes
256272
// For now we just remove the validation step from here as it proved difficult to

thirdparty

0 commit comments

Comments
 (0)