[xmlsec] Allow parsing of huge documents
Erwann ABALEA
erwann.abalea at keynectis.com
Mon May 30 08:17:19 PDT 2011
Bonjour,
I wanted to decrypt (from command line) a 40MB XML document, and
encountered a "huge memory" error (don't remember the exact error
message, but I've tracked it to be tied to a 10MB limit for a single
text node in libxml2).
I wanted to pass the necessary option to the parser context
(XML_PARSE_HUGE), but found no way to specify it.
In fact, the xmlsec1 program only calls the xmlSecParseFile()
function, with no other argument than the file name. I then had to
modify this function, here's a dirty patch:
-----
--- xmlsec1-1.2.9/src/parser.c 2003-07-21 05:12:47.000000000 +0200
+++ xmlsec1-1.2.9.new/src/parser.c 2011-05-30 16:53:42.926839623
+0200
@@ -405,6 +405,8 @@
return(NULL);
}
+ xmlCtxtUseOptions (ctxt, XML_PARSE_HUGE);
+
/* todo: set directories from current doc? */
if ((ctxt->directory == NULL) && (directory == NULL))
directory = xmlParserGetDirectory(filename);
-----
This patch doesn't verify the result of xmlCtxtUseOptions(). That's
bad. I know.
--
Erwann ABALEA <erwann.abalea at keynectis.com>
Département R&D
KEYNECTIS
-----
Manuals out, after all possible keystrokes have failed.
More information about the xmlsec
mailing list