[xmlsec] Allow parsing of huge documents

Aleksey Sanin aleksey at aleksey.com
Mon May 30 11:27:44 PDT 2011


Thanks,

I'll update the code.

Aleksey


On 5/30/11 8:17 AM, Erwann ABALEA wrote:
> 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.
>


More information about the xmlsec mailing list