components/libxslt/patches/CVE-2012-6139-1.patch
author Petr Sumbera <petr.sumbera@oracle.com>
Mon, 26 Aug 2013 13:00:27 -0700
branchs11u1-sru
changeset 2748 76a9a8bd58ae
permissions -rw-r--r--
16554178 problem in LIBRARY/LIBXSLT

From dc11b6b379a882418093ecc8adf11f6166682e8d Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <[email protected]>
Date: Sun, 21 Oct 2012 17:02:25 +0000
Subject: Fix crash with empty xsl:key/@match attribute

See https://bugzilla.gnome.org/show_bug.cgi?id=685328

Also improve some xsl:key error messages.
---
diff --git a/libxslt/keys.c b/libxslt/keys.c
index a995338..b8f1455 100644
--- a/libxslt/keys.c
+++ b/libxslt/keys.c
@@ -312,8 +312,8 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
 	        end = skipPredicate(match, end);
 		if (end <= 0) {
 		    xsltTransformError(NULL, style, inst,
-		                       "key pattern is malformed: %s",
-				       key->match);
+		        "xsl:key : 'match' pattern is malformed: %s",
+		        key->match);
 		    if (style != NULL) style->errors++;
 		    goto error;
 		}
@@ -322,7 +322,7 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
 	}
 	if (current == end) {
 	    xsltTransformError(NULL, style, inst,
-			       "key pattern is empty\n");
+			       "xsl:key : 'match' pattern is empty\n");
 	    if (style != NULL) style->errors++;
 	    goto error;
 	}
@@ -345,6 +345,12 @@ xsltAddKey(xsltStylesheetPtr style, const xmlChar *name,
 	}
 	current = end;
     }
+    if (pattern == NULL) {
+        xsltTransformError(NULL, style, inst,
+                           "xsl:key : 'match' pattern is empty\n");
+        if (style != NULL) style->errors++;
+        goto error;
+    }
 #ifdef WITH_XSLT_DEBUG_KEYS
     xsltGenericDebug(xsltGenericDebugContext,
 	"   resulting pattern %s\n", pattern);
@@ -359,14 +365,14 @@ xsltAddKey(xsltStylesheetPtr style, cons
     key->comp = xsltXPathCompile(style, pattern);
     if (key->comp == NULL) {
 	xsltTransformError(NULL, style, inst,
-		"xsl:key : XPath pattern compilation failed '%s'\n",
+		"xsl:key : 'match' pattern compilation failed '%s'\n",
 		         pattern);
 	if (style != NULL) style->errors++;
     }
     key->usecomp = xsltXPathCompile(style, use);
     if (key->usecomp == NULL) {
 	xsltTransformError(NULL, style, inst,
-		"xsl:key : XPath pattern compilation failed '%s'\n",
+		"xsl:key : 'use' expression compilation failed '%s'\n",
 		         use);
 	if (style != NULL) style->errors++;
     }
--
cgit v0.9.2