Accepting request 1079581 from multimedia:libs

OBS-URL: https://build.opensuse.org/request/show/1079581
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lcms2?expand=0&rev=38
This commit is contained in:
Dominique Leuenberger 2023-04-16 14:06:48 +00:00 committed by Git OBS Bridge
commit 54ec233ff0
5 changed files with 21 additions and 83 deletions

View File

@ -1,77 +0,0 @@
From a9e4601ceb3a185d4f78cc0cfbd285cf0c399e9d Mon Sep 17 00:00:00 2001
From: Marti Maria <marti.maria@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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:28474ea6f6591c4d4cee972123587001a4e6e353412a41b3e9e82219818d5740
size 7406694

3
lcms2-2.15.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b20cbcbd0f503433be2a4e81462106fa61050a35074dc24a4e356792d971ab39
size 7548405

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Sat Apr 15 09:49:37 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 2.15:
* New MESON build system, many thanks to amispark and Lovell
Fuller for bringing this.
* Fixed a bug that caused memory corruption on colord
* cmsReadRawTag can read portions of tags again. Removing this
caused colord to segfault when dumping profiles
* Added more checks based of fuzzer discoveries.
* MSYS2 can now compile lcms2
* Checked on Apple Silicon M1 and M2
* Fixed a bug of fastfloat plug-in that affected Krita CMYK
color selector
- drop 0001-fix-memory-corruption-when-unregistering-plugins.patch (upstream)
-------------------------------------------------------------------
Mon Dec 12 08:50:13 UTC 2022 - Dirk Müller <dmueller@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package lcms2
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
Name: lcms2
Version: 2.14
Version: 2.15
Release: 0
Summary: Little CMS Engine - A color management library and tools
License: MIT
@ -27,7 +27,6 @@ Source0: https://github.com/mm2/Little-CMS/releases/download/lcms%{versio
Source1: baselibs.conf
Patch0: lcms2-ocloexec.patch
Patch1: lcms2-visibility.patch
Patch2: 0001-fix-memory-corruption-when-unregistering-plugins.patch
%if 0%{?suse_version}
BuildRequires: autoconf
BuildRequires: glibc-devel