[mingw-libxslt: 7/20] Fix a locking bug in 1.1.25 (patch from native libxslt package)

Kalev Lember kalev at fedoraproject.org
Wed Mar 7 15:47:42 UTC 2012


commit e66f17198978571c9c942c8d6cdd277c55589b60
Author: epienbro <epienbro at fedoraproject.org>
Date:   Mon Sep 21 21:45:50 2009 +0000

    Fix a locking bug in 1.1.25 (patch from native libxslt package)

 libxslt-1.1.25-locking.patch |  125 ++++++++++++++++++++++++++++++++++++++++++
 mingw32-libxslt.spec         |    9 +++-
 2 files changed, 133 insertions(+), 1 deletions(-)
---
diff --git a/libxslt-1.1.25-locking.patch b/libxslt-1.1.25-locking.patch
new file mode 100644
index 0000000..9c8f5fe
--- /dev/null
+++ b/libxslt-1.1.25-locking.patch
@@ -0,0 +1,125 @@
+commit 2e8defa7ccef2f76fb1cbfe9e9673d8e4b6cf1d6
+Author: Daniel Veillard <veillard at redhat.com>
+Date:   Sun Sep 20 11:51:52 2009 +0200
+
+    595612 Try to fix some locking problems
+    
+    * libxslt/extensions.c: there were still cases where the normal
+      code path could led to trying to mtake again the extension lock
+      go over all entry points of the module and clean things up
+
+diff --git a/libxslt/extensions.c b/libxslt/extensions.c
+index ebb81f5..6187b7a 100644
+--- a/libxslt/extensions.c
++++ b/libxslt/extensions.c
+@@ -313,8 +313,6 @@ typedef void (*exsltRegisterFunction) (void);
+  * by LIBXSLT_DEFAULT_PLUGINS_PATH() which is determined at
+  * compile time.
+  *
+- * Always called with xsltExtMutex lock taken.
+- *
+  * Returns 0 if successful, -1 in case of error. 
+  */
+ 
+@@ -550,10 +548,14 @@ xsltRegisterExtPrefix(xsltStylesheetPtr style,
+     if (xsltExtensionsHash != NULL) {
+         xsltExtModulePtr module;
+ 
++        xmlMutexLock(xsltExtMutex);
+         module = xmlHashLookup(xsltExtensionsHash, URI);
++        xmlMutexUnlock(xsltExtMutex);
+         if (NULL == module) {
+             if (!xsltExtModuleRegisterDynamic(URI)) {
++                xmlMutexLock(xsltExtMutex);
+                 module = xmlHashLookup(xsltExtensionsHash, URI);
++                xmlMutexUnlock(xsltExtMutex);
+             }
+         }
+         if (module != NULL) {
+@@ -1669,18 +1671,13 @@ xsltExtElementLookup(xsltTransformContextPtr ctxt,
+     if ((name == NULL) || (URI == NULL))
+         return (NULL);
+ 
+-    xmlMutexLock(xsltExtMutex);
+-
+     if ((ctxt != NULL) && (ctxt->extElements != NULL)) {
+         XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->extElements, name, URI);
+         if (ret != NULL) {
+-            xmlMutexUnlock(xsltExtMutex);
+             return(ret);
+         }
+     }
+ 
+-    xmlMutexUnlock(xsltExtMutex);
+-
+     ret = xsltExtModuleElementLookup(name, URI);
+ 
+     return (ret);
+@@ -1707,19 +1704,23 @@ xsltExtModuleElementLookup(const xmlChar * name, const xmlChar * URI)
+ 
+     ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI);
+ 
++    xmlMutexUnlock(xsltExtMutex);
++
+     /*
+      * if function lookup fails, attempt a dynamic load on
+      * supported platforms
+      */
+     if (NULL == ext) {
+         if (!xsltExtModuleRegisterDynamic(URI)) {
++            xmlMutexLock(xsltExtMutex);
++
+             ext = (xsltExtElementPtr)
+ 	          xmlHashLookup2(xsltElementsHash, name, URI);
++
++            xmlMutexUnlock(xsltExtMutex);
+         }
+     }
+ 
+-    xmlMutexUnlock(xsltExtMutex);
+-
+     if (ext == NULL)
+         return (NULL);
+     return (ext->transform);
+@@ -1747,13 +1748,18 @@ xsltExtModuleElementPreComputeLookup(const xmlChar * name,
+ 
+     ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI);
+ 
++    xmlMutexUnlock(xsltExtMutex);
++
+     if (ext == NULL) {
+         if (!xsltExtModuleRegisterDynamic(URI)) {
++            xmlMutexLock(xsltExtMutex);
++
+             ext = (xsltExtElementPtr)
+ 	          xmlHashLookup2(xsltElementsHash, name, URI);
++
++            xmlMutexUnlock(xsltExtMutex);
+         }
+     }
+-    xmlMutexUnlock(xsltExtMutex);
+ 
+     if (ext == NULL)
+         return (NULL);
+@@ -1856,15 +1862,19 @@ xsltExtModuleTopLevelLookup(const xmlChar * name, const xmlChar * URI)
+ 
+     XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI);
+ 
++    xmlMutexUnlock(xsltExtMutex);
++
+     /* if lookup fails, attempt a dynamic load on supported platforms */
+     if (NULL == ret) {
+         if (!xsltExtModuleRegisterDynamic(URI)) {
++            xmlMutexLock(xsltExtMutex);
++
+             XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI);
++
++            xmlMutexUnlock(xsltExtMutex);
+         }
+     }
+ 
+-    xmlMutexUnlock(xsltExtMutex);
+-
+     return (ret);
+ }
+ 
diff --git a/mingw32-libxslt.spec b/mingw32-libxslt.spec
index 91aef59..2b057bf 100644
--- a/mingw32-libxslt.spec
+++ b/mingw32-libxslt.spec
@@ -7,7 +7,7 @@
 
 Name:           mingw32-libxslt
 Version:        1.1.25
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        MinGW Windows Library providing the Gnome XSLT engine
 
 License:        MIT
@@ -18,6 +18,8 @@ BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildArch:      noarch
 
+Patch1:         libxslt-1.1.25-locking.patch
+
 # Fix compilation on MinGW environments
 Patch1000:      mingw32-libxslt-dont-use-pthread.patch
 
@@ -61,6 +63,8 @@ Static version of the MinGW Windows LibXSLT library.
 # this isn't interesting for MinGW environments
 #%patch0 -p1
 
+%patch1 -p1
+
 %patch1000 -p1
 
 libtoolize --force --copy
@@ -112,6 +116,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Mon Sep 21 2009 Erik van Pienbroek <epienbro at fedoraproject.org> - 1.1.25-2
+- Fix a locking bug in 1.1.25 (patch from native libxslt package)
+
 * Thu Sep 17 2009 Erik van Pienbroek <epienbro at fedoraproject.org> - 1.1.25-1
 - Update to 1.1.25
 - Dropped upstreamed CVE patch


More information about the scm-commits mailing list