View Issue Details [ Jump to Notes ] | [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0014551 | CDash | CMake | public | 2013-11-07 17:54 | 2013-11-08 03:32 |
|
Reporter | Pedro Navarro | |
Assigned To | Julien Jomier | |
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | |
Platform | | OS | | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 2.2 | |
|
Summary | 0014551: [PATCH] CDash gives out of memory errors when attempting to XSLT transform large XML files |
Description | Some our generated XML files can be quite large and they can have text nodes that exceed the built-in libXML limit (by default 10 Mb). That happens a lot on Dynamic Analysis files or large test output logs.
According to PHP's documentation (http://us1.php.net/manual/en/libxml.constants.php [^]) the LIBXML_PARSEHUGE flag can be passed to loadXML so it sets libxml's XML_PARSE_HUGE_FLAG, which "relaxes any hardcoded limit from the parser. This affects limits like maximum depth of a document or the entity recursion, as well as limits of the size of text nodes." According to the documentation, "the flag is only available in Libxml >= 2.7.0 (as of PHP >= 5.3.2 and PHP >= 5.2.12)"
The patch checks if LIBXML_VERSION is >= 20700 and, if it is, passes LIBXML_PARSEHUGE when calling loadXML:
$xml->loadXML($args[$xml_arg], LIBXML_PARSEHUGE);
$xsl->loadXML(file_get_contents($xsl_arg), LIBXML_PARSEHUGE);
|
Tags | No tags attached. |
|
Attached Files | 0001-Use-the-LIBXML_PARSEHUGE-flag-when-loading-XML-files.patch [^] (1,023 bytes) 2013-11-07 17:54 [Show Content] [Hide Content]From 88c5e0f7fef0b4a6b68e2f1d53f0cc001480d3b3 Mon Sep 17 00:00:00 2001
From: Pedro Navarro <pnavarro@netflix.com>
Date: Thu, 7 Nov 2013 14:50:41 -0800
Subject: [PATCH] Use the LIBXML_PARSEHUGE flag when loading XML files
---
cdash/common.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/cdash/common.php b/cdash/common.php
index 6261eff..c639e9d 100644
--- a/cdash/common.php
+++ b/cdash/common.php
@@ -39,8 +39,14 @@ if (PHP_VERSION >= 5) {
$xsl = new DomDocument;
// Load the xml document and the xsl template
- $xml->loadXML($args[$xml_arg]);
- $xsl->loadXML(file_get_contents($xsl_arg));
+ if(LIBXML_VERSION >= 20700) {
+ $xmlOptions = LIBXML_PARSEHUGE;
+ } else {
+ $xmlOptions = 0;
+ }
+
+ $xml->loadXML($args[$xml_arg], $xmlOptions);
+ $xsl->loadXML(file_get_contents($xsl_arg), $xmlOptions);
// Load the xsl template
$xsltproc->importStyleSheet($xsl);
--
1.7.10.4
|
|