Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package lcms2 for openSUSE:Factory checked 
in at 2022-11-17 17:23:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lcms2 (Old)
 and      /work/SRC/openSUSE:Factory/.lcms2.new.1597 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lcms2"

Thu Nov 17 17:23:42 2022 rev:36 rq:1036010 version:2.14

Changes:
--------
--- /work/SRC/openSUSE:Factory/lcms2/lcms2.changes      2022-11-12 
17:40:57.802094486 +0100
+++ /work/SRC/openSUSE:Factory/.lcms2.new.1597/lcms2.changes    2022-11-17 
17:23:50.672855964 +0100
@@ -1,0 +2,7 @@
+Wed Nov 16 07:39:44 UTC 2022 - Dave Plater <davejpla...@gmail.com>
+
+- Removed reverse-0001-fix-memory-leaks-on-testbed.patch and added
+  0001-fix-memory-corruption-when-unregistering-plugins.patch as
+  final fix for https://github.com/hughsie/colord/issues/145
+
+-------------------------------------------------------------------

Old:
----
  reverse-0001-fix-memory-leaks-on-testbed.patch

New:
----
  0001-fix-memory-corruption-when-unregistering-plugins.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lcms2.spec ++++++
--- /var/tmp/diff_new_pack.h6NZUr/_old  2022-11-17 17:23:51.256859053 +0100
+++ /var/tmp/diff_new_pack.h6NZUr/_new  2022-11-17 17:23:51.264859096 +0100
@@ -27,9 +27,7 @@
 Source1:        baselibs.conf
 Patch0:         lcms2-ocloexec.patch
 Patch1:         lcms2-visibility.patch
-%ifarch i586
-Patch2:         reverse-0001-fix-memory-leaks-on-testbed.patch
-%endif
+Patch2:         0001-fix-memory-corruption-when-unregistering-plugins.patch
 %if 0%{?suse_version}
 BuildRequires:  autoconf
 BuildRequires:  glibc-devel

++++++ 0001-fix-memory-corruption-when-unregistering-plugins.patch ++++++
>From a9e4601ceb3a185d4f78cc0cfbd285cf0c399e9d Mon Sep 17 00:00:00 2001
From: Marti Maria <marti.ma...@littlecms.com>
Date: Sat, 12 Nov 2022 20:00:46 +0100
Subject: [PATCH] fix memory corruption when unregistering plugins

unregistering plugins twice may corrupt memory. This commit fixes that.
---
 plugins/fast_float/testbed/fast_float_testbed.c |  4 ++--
 src/cmsplugin.c                                 | 16 +++++++++-------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/plugins/fast_float/testbed/fast_float_testbed.c 
b/plugins/fast_float/testbed/fast_float_testbed.c
index ea23c10..addef00 100644
--- a/plugins/fast_float/testbed/fast_float_testbed.c
+++ b/plugins/fast_float/testbed/fast_float_testbed.c
@@ -2468,7 +2468,7 @@ int main()
        trace("Installing plug-in ... ");
        cmsPlugin(cmsFastFloatExtensions());
        trace("done.\n\n");
-             
+                    
        CheckComputeIncrements();
 
        // 15 bit functionality
@@ -2508,7 +2508,7 @@ int main()
        
        trace("\nAll tests passed OK\n");
 
-       cmsUnregisterPlugins();
+       cmsDeleteContext(0);
 
        return 0;
 }
diff --git a/src/cmsplugin.c b/src/cmsplugin.c
index 7d038d2..1d8c358 100644
--- a/src/cmsplugin.c
+++ b/src/cmsplugin.c
@@ -795,9 +795,7 @@ void* _cmsContextGetClientChunk(cmsContext ContextID, 
_cmsMemoryClient mc)
 // many different plug-ins simultaneously, then there is no way to 
 // identify which plug-in to unregister.
 void CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID)
-{
-    struct _cmsContext_struct* ctx = _cmsGetContext(ContextID);
-
+{    
     _cmsRegisterMemHandlerPlugin(ContextID, NULL);
     _cmsRegisterInterpPlugin(ContextID, NULL);
     _cmsRegisterTagTypePlugin(ContextID, NULL);
@@ -811,9 +809,6 @@ void CMSEXPORT cmsUnregisterPluginsTHR(cmsContext ContextID)
     _cmsRegisterMutexPlugin(ContextID, NULL);
     _cmsRegisterParallelizationPlugin(ContextID, NULL);
 
-   if (ctx->MemPool != NULL)
-       _cmsSubAllocDestroy(ctx->MemPool);
-   ctx->MemPool = NULL;
 }
 
 
@@ -981,7 +976,14 @@ cmsContext CMSEXPORT cmsDupContext(cmsContext ContextID, 
void* NewUserData)
 // The ContextID can no longer be used in any THR operation.  
 void CMSEXPORT cmsDeleteContext(cmsContext ContextID)
 {
-    if (ContextID != NULL) {
+    if (ContextID == NULL) {
+
+        cmsUnregisterPlugins();
+        if (globalContext.MemPool != NULL)
+            _cmsSubAllocDestroy(globalContext.MemPool);
+        globalContext.MemPool = NULL;
+    }
+    else {
 
         struct _cmsContext_struct* ctx = (struct _cmsContext_struct*) 
ContextID;              
         struct _cmsContext_struct  fakeContext;  
-- 
2.35.3

Reply via email to