[Debian-med-packaging] Bug#988417: dcmtk: Memory leak in OFCharacterEncoding::selectEncoding

Mathieu Malaterre malat at debian.org
Mon May 17 09:38:33 BST 2021


Package: dcmtk
Version: 3.6.4-2.1
Followup-For: Bug #988417

Dear Maintainer,

Here is a possible patch.

-- System Information:
Debian Release: 10.9
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 'proposed-updates-debug'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-0.bpo.5-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dcmtk depends on:
ii  adduser     3.118
ii  libc6       2.28-10
ii  libdcmtk14  3.6.4-2.1
ii  libgcc1     1:8.3.0-6
ii  libstdc++6  8.3.0-6
ii  libxml2     2.9.4+dfsg1-7+deb10u1
ii  zlib1g      1:1.2.11.dfsg-1

dcmtk recommends no packages.

dcmtk suggests no packages.

-- no debconf information
-------------- next part --------------
diff --git a/ofstd/libsrc/ofchrenc.cc b/ofstd/libsrc/ofchrenc.cc
index 4bc0ed598..6ff44f4dc 100644
--- a/ofstd/libsrc/ofchrenc.cc
+++ b/ofstd/libsrc/ofchrenc.cc
@@ -63,6 +63,7 @@ const unsigned int OFCharacterEncoding::CPC_UTF8   = CP_UTF8;
 
 #include <unicode/ucnv.h>
 #include <unicode/ucnv_err.h>
+#include <unicode/uclean.h>
 
 #define CONVERSION_BUFFER_SIZE 1024
 
@@ -270,6 +271,14 @@ class OFCharacterEncoding::Implementation
     {
         ucnv_close(sourceConverter);
         ucnv_close(targetConverter);
+#ifdef WITH_THREADS
+        static OFMutex icuCleanupMutex;  // mutex protecting access to u_cleanup
+        icuCleanupMutex.lock();
+#endif
+        u_cleanup(); // mostly for valgrind
+#ifdef WITH_THREADS
+        icuCleanupMutex.unlock();
+#endif
     }
 
   private:


More information about the Debian-med-packaging mailing list