--- /dev/null
+[URL properties]
+ViewMode=fsview_part
--- /dev/null
+dcmtk (3.6.1~20150924-1) unstable; urgency=medium
+
+ With this new snapshot upstream removed the wwwapps tools and
+ perl scripts that were developed for the CAR 1996 modality showcase, and
+ that are largely unused and unsupported.
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Tue, 01 Dec 2015 02:46:03 +0100
+
+dcmtk (3.6.1~20150629-2) unstable; urgency=medium
+
+ Version 3.6.1 has compatible change of the index.dat format that is not
+ backward compatible, and the current dcmtk is trashing the memory (one
+ byte of) when using dcmqrscp. All files in
+
+ /var/lib/dcmtk/*/index.dat
+
+ that are create with version 3.6.0 or before will be corrupted and
+ users need to reconstruct the db.
+
+ The interested user might like to inspect the upstream commit
+
+ http://git.dcmtk.org/web?p=dcmtk.git;a=commitdiff;h=c8423ab1fcf0273061462697b8eca56f894984c7
+
+ -- Andreas Tille <tille@debian.org> Thu, 08 Oct 2015 13:06:03 +0200
--- /dev/null
+dcmtk (3.6.8-7) unstable; urgency=medium
+
+ * Team upload.
+ * 0001-Fixed-unchecked-typecasts-of-DcmItem-search-results.patch.
+ Patch refreshed.
+ * 0004-Fixed-two-segmentation-faults.patch: unfuzz.
+ * 0007-CVE-2024-47796.patch: new.
+ This patch addresses CVE-2024-47796. (Closes: #1093043)
+ * 0008-CVE-2024-52333.patch: new.
+ This patch addresses CVE-2024-52333. (Closes: #1093047)
+
+ -- Étienne Mollier <emollier@debian.org> Sat, 18 Jan 2025 16:30:29 +0100
+
+dcmtk (3.6.8-6) unstable; urgency=medium
+
+ * d/t/run-unit-test: Fix unit-test for new release. Closes: #1075917
+ * d/patches: Fixed possible overflows when allocating memory. Closes: #1074483
+
+ -- Mathieu Malaterre <malat@debian.org> Mon, 08 Jul 2024 13:31:04 +0200
+
+dcmtk (3.6.8-5) unstable; urgency=medium
+
+ * Upload 3.6.8 to unstable
+ * d/control: Bump Std-Vers to 4.7.0 no changes needed
+
+ -- Mathieu Malaterre <malat@debian.org> Fri, 05 Jul 2024 11:24:00 +0200
+
+dcmtk (3.6.8-4) experimental; urgency=medium
+
+ * d/rules: Add dcmtk-data package
+ * d/control: Add missing dependency on libjs-jquery. Closes: #989108
+ * d/control: Reduce number of dependencies for -dev package
+ * New upstream version 3.6.8
+
+ -- Mathieu Malaterre <malat@debian.org> Mon, 24 Jun 2024 20:43:54 +0200
+
+dcmtk (3.6.7-15) unstable; urgency=medium
+
+ * Team upload.
+ [ Adrian Bunk ]
+ * Update two of the previously applied patches to avoid breaking the ABI.
+ Closes: #1070207.
+
+ -- Santiago Vila <sanvila@debian.org> Mon, 24 Jun 2024 12:30:00 +0200
+
+dcmtk (3.6.7-14) unstable; urgency=medium
+
+ * Team upload.
+ [ Emanuele Rocca ]
+ * Do not drop graphviz from build-depends-indep for armhf and armel.
+ [ Adrian Bunk ]
+ * CVE-2024-28130: Segmentation faults due to incorrect typecast
+ (Closes: #1070207)
+ * CVE-2024-34508: Segmentation fault via invalid DIMSE message
+ * CVE-2024-34509: Segmentation fault via invalid DIMSE message
+
+ -- Santiago Vila <sanvila@debian.org> Wed, 05 Jun 2024 14:30:00 +0200
+
+dcmtk (3.6.7-13) unstable; urgency=medium
+
+ * Team upload.
+ * Marked Debian-specific patches as not needing forwarding to
+ upstream.
+ * d/control: add explicit dependency on libnsl-dev. Closes: #1066422.
+
+ -- Michael R. Crusoe <crusoe@debian.org> Tue, 19 Mar 2024 15:24:15 +0100
+
+dcmtk (3.6.7-12) unstable; urgency=medium
+
+ * Team upload.
+
+ [ Emanuele Rocca ]
+ * Do not build-depend on graphviz on armhf and armel. The package is
+ currently not installable on those arches due to the ongoing t64
+ transition. Closes: #1067147
+
+ -- Michael R. Crusoe <crusoe@debian.org> Tue, 19 Mar 2024 12:30:03 +0100
+
+dcmtk (3.6.7-11) unstable; urgency=medium
+
+ * Fix typo in target distribution during upload.
+
+ -- Sebastien Jodogne <s.jodogne@gmail.com> Tue, 19 Mar 2024 11:54:38 +0100
+
+dcmtk (3.6.7-10) unreleased; urgency=medium
+
+ * Fix build on armel. Closes: #1060104
+
+ -- Sebastien Jodogne <s.jodogne@gmail.com> Tue, 19 Mar 2024 11:03:28 +0100
+
+dcmtk (3.6.7-9.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Rename libraries for 64-bit time_t transition. Closes: #1062022
+
+ -- Michael Hudson-Doyle <mwhudson@debian.org> Wed, 28 Feb 2024 01:17:02 +0000
+
+dcmtk (3.6.7-9) unstable; urgency=medium
+
+ * Team upload.
+ * Fix postrm
+ Closes: #1038776
+
+ -- Andreas Tille <tille@debian.org> Thu, 22 Jun 2023 09:53:48 +0200
+
+dcmtk (3.6.7-8) unstable; urgency=medium
+
+ * d/patches: Fix CVE-2022-43272. Closes: #1027165
+ * d/control: Bump Std-Vers to 4.6.2 no changes needed
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 04 Jan 2023 11:15:13 +0100
+
+dcmtk (3.6.7-7) unstable; urgency=medium
+
+ [ Andreas Tille ]
+ * Team upload.
+ * Prevent bashism in run-unit-test
+ * Enable running run-unit-test from any directory
+ * Add maintscript to remove outdated conffiles
+ Closes: #990134
+ * On purge remove /var/lib/dcmtk/db/STORESCP if exists
+ Closes: #990135
+
+ [ Mathieu Malaterre ]
+ * d/control: Add missing dependency on libjs-jquery. Closes: #989108
+
+ -- Andreas Tille <tille@debian.org> Tue, 06 Dec 2022 11:52:52 +0100
+
+dcmtk (3.6.7-6) unstable; urgency=medium
+
+ [ Mathieu Malaterre ]
+ * Team upload.
+ * d/control: libdcmtk4 is not present in o-o-stable
+ * d/postrm: Fix possible-bashism-in-maintainer-script
+ * d/patches: CVE-2022-2119 CVE-2022-2120. Closes: #1017743
+
+ [ Mohammed Bilal ]
+ * Add autopkgtests
+ * Bump Standards-Version to 4.6.1 (no changes needed)
+
+ -- Mathieu Malaterre <malat@debian.org> Mon, 22 Aug 2022 17:02:26 +0200
+
+dcmtk (3.6.7-5) unstable; urgency=medium
+
+ [ Gregory C. Sharp ]
+ * Change CMAKE_INSTALL_DATADIC to CMAKE_INSTALL_DATADIR in an attempt
+ to fix dictionary load failure
+
+ -- Andreas Tille <tille@debian.org> Fri, 17 Jun 2022 21:41:44 +0200
+
+dcmtk (3.6.7-4) unstable; urgency=medium
+
+ * Team upload.
+ * Fix install dir of dictionaries
+ Closes: #1012417
+
+ -- Andreas Tille <tille@debian.org> Tue, 07 Jun 2022 09:05:06 +0200
+
+dcmtk (3.6.7-3) unstable; urgency=medium
+
+ * Source-only upload
+ * Breaks+Replaces: libdcmtk16
+
+ -- Andreas Tille <tille@debian.org> Mon, 06 Jun 2022 19:39:49 +0200
+
+dcmtk (3.6.7-2) unstable; urgency=medium
+
+ * Team upload.
+ * Upstream has bumped SONAME thus rename binary package for shared
+ library
+ Closes: #1010536
+
+ -- Andreas Tille <tille@debian.org> Wed, 04 May 2022 09:08:00 +0200
+
+dcmtk (3.6.7-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream version
+ Closes: #1010474
+ * Point watch file to Github
+ * Drop useless get-orig-source target (routine-update)
+ * Remove trailing whitespace in debian/changelog (routine-update)
+ * Remove trailing whitespace in debian/rules (routine-update)
+ * Drop debian/gbp.conf
+ * Install pkgconfig file
+ * Review d/copyright
+ * Drop unneeded lintian-override
+
+ -- Andreas Tille <tille@debian.org> Tue, 03 May 2022 10:28:02 +0200
+
+dcmtk (3.6.6-6) UNRELEASED; urgency=medium
+
+ * d/dcmtk.postrm: Added check to remove dcmtk user (Closes: #987972)
+ * d/dcmtk.postinst: Change dcmtk user shell to nologin
+
+ -- Lance Lin <LQi254@protonmail.com> Wed, 13 Apr 2022 19:36:57 +0700
+
+dcmtk (3.6.6-5) unstable; urgency=medium
+
+ * d/rules: Re-exposed --interleave-none option. Closes: #1001703
+ * d/rules: Start using c++17 since default for GCC-11
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 06 Jan 2022 16:33:20 +0100
+
+dcmtk (3.6.6-4) unstable; urgency=medium
+
+ * d/u/metadata: Add publication about DCMTK
+ * d/patches: Add new patch to fix random unit test failures
+ * d/control: Bump Std-Vers to 4.6.0, no changes needed
+ * d/watch: Update to latest uscan version
+ * d/rules: Remove as-needed-linker-flag
+ * d/control: Add missing Rules-Requires-Root: no
+ * d/patches: Import bug-fixes from git/master
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 08 Dec 2021 10:27:21 +0100
+
+dcmtk (3.6.6-3) unstable; urgency=medium
+
+ * d/patches: Fix compilation of dicomscope. Closes: #1000220
+ * d/control: Add myself as Uploader
+
+ -- Mathieu Malaterre <malat@debian.org> Tue, 23 Nov 2021 08:15:20 +0100
+
+dcmtk (3.6.6-2) unstable; urgency=medium
+
+ * Team upload.
+ * d/patches: Fix unit test suite on big endian machine
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 18 Nov 2021 08:44:13 +0100
+
+dcmtk (3.6.6-1) unstable; urgency=medium
+
+ [ Andreas Tille ]
+ * Team upload.
+ * Remove patches thanks to a hint by Jörg Riesmeier (see #981326)
+ * Rename debian/.gitlab-ci.yml to debian/salsa-ci.yml to use a unique
+ name in all Debian Med packages
+
+ [ Mathieu Malaterre ]
+ * d/rules: Set ICONV to OFF
+ * d/rules: Remove bogus setting of c++11 in d/rules
+ * d/rules: Prefer stdlibc (iconv) setting over ICU. Closes: #988417
+ * d/rules: Prefer STL over DCMTK convenient copy
+ * d/rules: DCMTK_ENABLE_CHARSET_CONVERSION is an internal variable
+ * d/patches: Properly install dcm2xml.dtd/dumppat.txt. Closes: #993025
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 17 Nov 2021 11:07:39 +0100
+
+dcmtk (3.6.6-1~ext1) experimental; urgency=medium
+
+ * d/ci: delete some generated files
+ * New upstream version 3.6.6
+ * d/: Update so-version
+ * d/copyright: Add new files with specific copyright
+
+ -- Gert Wollny <gewo@debian.org> Sun, 11 Apr 2021 17:24:39 +0200
+
+dcmtk (3.6.5-1) unstable; urgency=medium
+
+ * debian/control: switch to comat level 10
+ * d/rules: don't install libcharls.so Closes: #971433
+ Closes: #971412
+ * d/control: cme fix dpkg
+ * d/compat: remove obsolete file
+
+ -- Gert Wollny <gewo@debian.org> Tue, 10 Nov 2020 15:08:59 +0100
+
+dcmtk (3.6.5-1~exp1) experimental; urgency=medium
+
+ [ Andreas Tille ]
+ * Remove myself as Uploader
+
+ [ Gert Wollny ]
+ * New upstream version 3.6.5
+ * d/p: Update patches and remove 08 (applied upstream)
+ * Update SO version to 15
+ * d/copyright: all-over year and new files
+
+ -- Gert Wollny <gewo@debian.org> Fri, 20 Dec 2019 21:31:03 +0100
+
+dcmtk (3.6.4-2.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Revert to convenient charls copy for now. Closes: #923433
+
+ -- Mathieu Malaterre <malat@debian.org> Tue, 28 May 2019 21:39:19 +0200
+
+dcmtk (3.6.4-2) unstable; urgency=medium
+
+ * d/rules,d/p/03: Fix DATADIC path, Closes: #913304
+
+ -- Gert Wollny <gewo@debian.org> Sat, 19 Jan 2019 10:36:10 +0100
+
+dcmtk (3.6.4-1) unstable; urgency=medium
+
+ * d/p/09: Fix build with CharLS 2.0
+ * Upload to unstable
+
+ -- Gert Wollny <gewo@debian.org> Sat, 12 Jan 2019 16:10:06 +0100
+
+dcmtk (3.6.4-1~exp1) experimental; urgency=medium
+
+ [ Jelmer Vernooij ]
+ * Move source package lintian overrides to debian/source.
+ * Trim trailing whitespace.
+
+ [ Gert Wollny ]
+ * New upstream version 3.6.4
+ * d/p: Update patches for new release and remove old patches
+ * d/control: Update lib package name
+ * d/rules: Change dict install directory to new lib name
+ * d/dcmtk.postinst: Disable running chown recursively
+ * d/copyright: Add new libcmr files with non-OFFICE copyright
+
+ -- Gert Wollny <gewo@debian.org> Sun, 23 Dec 2018 10:43:41 +0100
+
+dcmtk (3.6.3-1~exp1) experimental; urgency=medium
+
+ * d/* correct by running 'git fix dpkg'
+ * d/watch: update link (thanks Pedro Fernando Arizpe Gómez)
+ * New upstream version 3.6.3
+ * d/patches: Update patches to apply to new version
+ * d/ .gitlab-ci.yml: Add this CI file
+ * p/d/03: Set DATDIC in CMakeLists.txt
+ * d/ Update SO version to 13
+ * d/p/03: Correct install path
+ * d/copyright: Update for added and moved files
+
+ -- Gert Wollny <gewo@debian.org> Sat, 11 Aug 2018 09:35:25 +0200
+
+dcmtk (3.6.2-3) unstable; urgency=medium
+
+ * d/control: Remove Juergen Salk from uploaders, Closes: #846787
+ * d/p/08: set CANONICAL_HOST_TYPE from cmake, Closes: #859203
+ * d/p/09: Fix format errors, Closes: #865418
+ * d/p/10:Add fix for possible string overflow
+
+ -- Gert Wollny <gewo@debian.org> Wed, 06 Sep 2017 10:09:08 +0000
+
+dcmtk (3.6.2-2) unstable; urgency=medium
+
+ * d/rules: install examples in arch-indep build to fix -A build
+
+ -- Gert Wollny <gewo@debian.org> Tue, 22 Aug 2017 12:46:09 +0000
+
+dcmtk (3.6.2-1) unstable; urgency=medium
+
+ * Upload to unstable
+ * d/control: Standards version 4.1.0 (no changes needed)
+
+ -- Gert Wollny <gewo@debian.org> Tue, 22 Aug 2017 10:05:31 +0000
+
+dcmtk (3.6.2-1~exp1) experimental; urgency=medium
+
+ * Update d/watch
+ * New upstream version 3.6.2 Closes: #868867
+ * d/p/* refresh patches
+ * drop d/p/09_ because it was applied upstream
+ * s/* update SO version
+ * d/copyright: add new files to copyright
+ * d/rules: drop more test programs and add manpage for msgserv
+ * d/rules enable use of C++11 features
+ * d/control: Add build dependency on help2man
+
+ -- Gert Wollny <gewo@debian.org> Wed, 02 Aug 2017 13:48:47 +0000
+
+dcmtk (3.6.1~20170228-2) unstable; urgency=medium
+
+ * d/p/09: Improve numerical stability by rounding the time to
+ the six decimal digits supported by dicom. Closes: #859204
+ #865452
+ * d/control: Correct dependency on libssl-dev for libdcmtk-dev
+ * d/control: Update standards version (no action needed)
+ * d/control: cme fix dpkg-control
+
+ -- Gert Wollny <gewo@debian.org> Thu, 22 Jun 2017 07:55:04 +0000
+
+dcmtk (3.6.1~20170228-1) unstable; urgency=medium
+
+ * Upload to unstable Closes: #747167
+ * d/rules: correctly enabling private tags, Closes: #859201
+ * d/rules: enable C++11 build
+
+ -- Gert Wollny <gewo@debian.org> Tue, 20 Jun 2017 18:58:39 +0000
+
+dcmtk (3.6.1~20170228-1~exp1) experimental; urgency=medium
+
+ [ Gert Wollny ]
+ * Set dependency to libssl-dev, Closes: #851083
+ * Update patches to new upstream
+ * d/p/02: correct calls to JpegLsEncode because system CharLS
+ interface of the bundled version differs from Debian version
+ * New upstream version 3.6.1~20170228
+ * Change to libdcmtk11 because of soname change
+ * Remove d/p/09 patch
+ * d/* Update package names and build rules to new SO-version
+ * d/copyright: mention Frank Vanden Berghen and his AFPL license
+ Thanks for spotting this: Thorsten Alteholz
+ * d/control: update self e-mail address in uploaders
+ * d/copyright: Add copyright information for new files
+
+ [ Mathieu Malaterre ]
+ * d/control: Remove self from Uploaders
+
+ -- Gert Wollny <gewo@debian.org> Mon, 20 Feb 2017 13:15:40 +0100
+
+dcmtk (3.6.1~20160216-2) unstable; urgency=medium
+
+ * d/p/08: remove SYSTEM_PROCESSOR usage for reproducible builds
+ * d/p/09: add patch to enable compileing against openssl-1.1
+ Closes: #828281
+ * d/p/04: update patch to remove duplicate entries
+ * d/rules: add hardening flags
+ * d/control: change conflict with libinsighttoolkit4-dev to breaks
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Sun, 03 Jul 2016 13:58:34 +0000
+
+dcmtk (3.6.1~20160216-1) experimental; urgency=medium
+
+ [ Gert Wollny ]
+ * New upstream version
+ * d/p/*: rebase patches
+ * d/p/06: Update patch to use ABI version as part of the library name
+ * d/*: Update files to correspond to new soversion 8.
+ Jumping from 5 to 8 because upstream uses 8.
+ * d/copyright: Update copyright information
+ * d/control: update standards version to 3.9.8
+ * d/control + d/rules: drop dbg package in favour of antomatic ones
+
+ [ Mattia Rizzolo ]
+ * d/control: Use secure URIs (https) in Vcs-Git.
+ * d/libdcmtk5.dirs: removed as useless.
+ * d/dcmtk.preinst: 'set -e' in the script instead of the shebang,
+ fixes lintian's maintainer-script-without-set-e
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Sun, 08 May 2016 21:59:06 +0000
+
+dcmtk (3.6.1~20150924-5) unstable; urgency=medium
+
+ * d/libdcmtk-dev revert last change since ITK-4.9 now supports
+ properly the dcmtk*.cmake files.
+ * d/control: conflict with older versions of libinsighttoolkit-dev
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Sat, 30 Jan 2016 23:11:21 +0100
+
+dcmtk (3.6.1~20150924-4) unstable; urgency=medium
+
+ * Do not install DCMTK*.cmake files, they break things.
+ cmake's FindDCMTK handles this case better without these files.
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Tue, 05 Jan 2016 21:42:56 +0100
+
+dcmtk (3.6.1~20150924-2) unstable; urgency=medium
+
+ * Update internal use of DCMDICT path Closes: #807691
+ * Correct Apache-2.0 copyright
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Fri, 11 Dec 2015 17:42:45 +0100
+
+dcmtk (3.6.1~20150924-1) unstable; urgency=medium
+
+ * New upstream version
+ * Move vcs to git
+ * Remove dcmtk-www, because it is no longer provided by upstream
+ * Because of ABI change rename library package to libdcmtk5
+ * Add libcharls-dev to libdcmtk-dev dependencies (reason: see below)
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Tue, 01 Dec 2015 02:46:03 +0100
+
+dcmtk (3.6.1~20150629-7) unstable; urgency=medium
+
+ * d/control: Add more dependencies to libdcmtk-dev, because the
+ cmake based build system creates a cmake use file that pulls in
+ these libraries for linking.
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Sun, 29 Nov 2015 21:16:37 +0100
+
+dcmtk (3.6.1~20150629-6) unstable; urgency=medium
+
+ * Change Provides:libdcmtk-dev to Provides:libdcmtk2-dev Closes: #805718
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Sat, 21 Nov 2015 13:58:54 +0100
+
+dcmtk (3.6.1~20150629-5) unstable; urgency=medium
+
+ * d/control: Add conflict/replace for libdcmtk4-dev
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Thu, 12 Nov 2015 13:30:12 +0100
+
+dcmtk (3.6.1~20150629-4) unstable; urgency=medium
+
+ * Add patch soversion_abi.patch to change not only the library file
+ name but also in the cmake related files.
+ * Add patch dont_export.. to not export all executables for cmake
+ Closes: #803304
+ * d/rules: remove code to add abi-suffix to libraries on install
+ * Add Gert Wollny to uploaders
+
+ -- Gert Wollny <gw.fossdev@gmail.com> Thu, 29 Oct 2015 11:51:54 +0100
+
+dcmtk (3.6.1~20150629-3) unstable; urgency=medium
+
+ * Adapt prerm script for dash
+ Closes: #803008
+ * small DEP5 fixes
+
+ -- Andreas Tille <tille@debian.org> Mon, 26 Oct 2015 12:11:22 +0100
+
+dcmtk (3.6.1~20150629-2) unstable; urgency=medium
+
+ * debian/copyright: DEP5
+ * unversioned -dev package
+ Closes: #800481
+ * Inform users about non-backward compatible changes in dcmtk database
+ when using dcmqrscp
+ Closes: #799039
+ * suppress lintian warnings no-symbols-control-file
+ * create empty dir /var/lib/dcmtk/db in package
+ Closes: #801735
+
+ -- Andreas Tille <tille@debian.org> Fri, 23 Oct 2015 23:29:57 +0200
+
+dcmtk (3.6.1~20150629-1) unstable; urgency=medium
+
+ * New upstream version
+ * cme fix dpkg-control
+ * libdcmtk4-dev conflicts libdcmtk2-dev
+ Closes: #769151
+ * Do gcc-5 transition on new version
+ * Conflicts/Replaces: libdcmtk3
+ Closes: #754583
+ * Do not hardcode path to invoke-rc.d in maintainer scripts
+ * Fix apache configuration (thanks for the patch to HAYASHI Kentaro
+ <kenhys@gmail.com>)
+ Closes: #779700
+ * Apply patch to fix performance problem (thanks for the patch to
+ Sebastien Jodogne <s.jodogne@chu.ulg.ac.be>)
+ Closes: #785400)
+ * Enable reproducible build (Thanks for the patch to Maria Valentina Marin
+ <marivalenm@gmail.com>)
+ Closes: #790133
+
+ -- Andreas Tille <tille@debian.org> Sun, 13 Sep 2015 20:31:57 +0200
+
+dcmtk (3.6.1~20140617-3) experimental; urgency=low
+
+ * Fix building/running on sparc.
+ * Really remove md5 files from doxygen HTML output
+
+ -- Mathieu Malaterre <malat@debian.org> Mon, 07 Jul 2014 09:09:49 +0200
+
+dcmtk (3.6.1~20140617-2) experimental; urgency=low
+
+ * Fix SIGSEGV on sparc
+ * Fix removal of md5 files on buildds
+
+ -- Mathieu Malaterre <malat@debian.org> Tue, 01 Jul 2014 11:15:54 +0200
+
+dcmtk (3.6.1~20140617-1) experimental; urgency=low
+
+ * New snapshot. Use ABI=4 as per upstream
+ * Refreshed patches, removed applied upstream
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 18 Jun 2014 08:44:51 +0200
+
+dcmtk (3.6.1~20131114-7) experimental; urgency=low
+
+ * Bump Std-Vers to 3.9.5, no changes needed
+ * Fix failing SCP test. Closes: #740342
+
+ -- Mathieu Malaterre <malat@debian.org> Fri, 28 Feb 2014 13:19:20 +0100
+
+dcmtk (3.6.1~20131114-6) experimental; urgency=low
+
+ * Remove non-ASCII char. Closes: #732673
+ * Fix setuid return value. Closes: #731434
+ * Update old copyright. Closes: #732672
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 27 Feb 2014 17:33:18 +0100
+
+dcmtk (3.6.1~20131114-5) experimental; urgency=low
+
+ * Increase timeout a little to fix issue on s390x
+ + d/p/timeout.patch
+
+ -- Mathieu Malaterre <malat@debian.org> Fri, 20 Dec 2013 11:02:48 +0100
+
+dcmtk (3.6.1~20131114-4) experimental; urgency=low
+
+ * Import patch from git (upstream)
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 19 Dec 2013 17:33:18 +0100
+
+dcmtk (3.6.1~20131114-3) experimental; urgency=low
+
+ * Another round of compilation fixes. Closes: #731434
+ * Fix installation. Closes: #731752
+ * Another attempt at fixing test. Closes: #730582
+
+ -- Mathieu Malaterre <malat@debian.org> Tue, 10 Dec 2013 15:15:52 +0100
+
+dcmtk (3.6.1~20131114-2) experimental; urgency=low
+
+ * Fix failing test (ofstd_markup_6). Closes: #730582
+ * Remove some spelling error in man pages. Closes: #730635
+ * Remove CMake overriding our compilation flags. Closes: #730636
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 05 Dec 2013 12:50:28 +0100
+
+dcmtk (3.6.1~20131114-1) experimental; urgency=low
+
+ * New snapshot. Closes: #723091, #715039
+ * Refresh patches
+
+ -- Mathieu Malaterre <malat@debian.org> Fri, 22 Nov 2013 19:55:25 +0100
+
+dcmtk (3.6.1~20121102-5) experimental; urgency=low
+
+ * Fix jquery.js removal when executing build-indep
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 04 Sep 2013 09:08:29 +0200
+
+dcmtk (3.6.1~20121102-4) experimental; urgency=low
+
+ * Fix buffer overflow in StudyInstanceUID. Closes: #715011
+ * Fix apache 2.4 transition. Closes: #669740
+ * Fix -doc installation. Closes: #717968
+
+ -- Mathieu Malaterre <malat@debian.org> Mon, 02 Sep 2013 11:13:46 +0200
+
+dcmtk (3.6.1~20121102-3) experimental; urgency=low
+
+ * fix lintian warning about jquery.js (doxygen generated)
+ * remove internal tests suite from dcmtk package
+ * cope with cmake and #701231
+ * Update patch d/p/bug706062.patch. Closes: #706062
+ * Upgrade for apache 2.4. Closes: #669740
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 19 Jun 2013 13:51:22 +0200
+
+dcmtk (3.6.1~20121102-2) experimental; urgency=low
+
+ * Install *.dic to versioned dir (See #709123)
+ * Add preliminary work to get iconv support
+
+ -- Mathieu Malaterre <malat@debian.org> Fri, 31 May 2013 17:39:30 +0200
+
+dcmtk (3.6.1~20121102-1) experimental; urgency=low
+
+ * Use new dh syntax
+ * Run w-a-s. Use B-D-I for doxygen
+ * Switch to cmake build system (allows parallel builds). Closes: #701801
+ * Use system CharLS. Closes: #705923
+ * Use SOP class uid with option. Closes: #706062
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 15 May 2013 10:34:58 +0200
+
+dcmtk (3.6.0-13) unstable; urgency=low
+
+ * Remove d/README.source, since source-format 3.0
+ * Update dcmtk-www README for install instructions
+ * Remove obsolete DMUA flag
+ * Bump Std-Vers to 3.9.4, no changes needed
+ * Provide a debug package. Closes: #690733
+ * Fix SIGSEGV. Closes: #703716
+
+ -- Mathieu Malaterre <malat@debian.org> Wed, 15 May 2013 10:10:29 +0200
+
+dcmtk (3.6.0-12) unstable; urgency=low
+
+ [ Andrey Rahmatullin ]
+ * Fix underlinked libraries. Closes: #677721
+ - debian/patches/underlink.patch
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 20 Dec 2012 13:20:45 +0100
+
+dcmtk (3.6.0-11) unstable; urgency=low
+
+ * Fix compilation with gcc 4.7. Closes: #674361
+ - debian/patches/bug674361.patch
+ * Make sure to link against libxml2. Closes: #510120
+ * Fix some underlinking. Closes: #674586
+ - debian/patches/underlink.patch
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 31 May 2012 11:31:16 +0200
+
+dcmtk (3.6.0-10) unstable; urgency=low
+
+ [ Andreas Tille ]
+ * debian/dcmtk.prerm: when purging dirs in /var/lib need to be
+ removed in advance. Closes: #660346
+
+ [ Mathieu Malaterre ]
+ * Use libpng-dev. Closes: #662296
+ * Use libtiff-dev for transition to tiff5
+ * Bump Std-Vers to 3.9.3. No changes needed
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Tue, 06 Mar 2012 23:01:59 +0100
+
+dcmtk (3.6.0-9) unstable; urgency=low
+
+ * Remove dot wrapper, not required anymore.
+ * Generate doc using svg instead of png to save disk space
+ * Fix compilation. Thanks to Bhavani Shankar. Closes: #646316
+ * Fix VCS URLs
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Wed, 23 Nov 2011 16:31:18 +0100
+
+dcmtk (3.6.0-8) unstable; urgency=low
+
+ * Adding a storescp daemon
+ * Remove convenient copy of CharLS. Closes: #631100
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Tue, 19 Jul 2011 17:08:19 +0200
+
+dcmtk (3.6.0-7) unstable; urgency=low
+
+ * Add a patch (from current git/master) to fix a regression. Closes: #630781
+ * Another fix to remove symlink only if exists
+ * Remove deprecated lintian override
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Fri, 17 Jun 2011 14:43:37 +0200
+
+dcmtk (3.6.0-6) unstable; urgency=low
+
+ * Make sure OFFIS_DCMTK_VERSION_NUMBER is really a number. Closes: #628168
+ * Update Standard Version to 3.9.2. No changes needed
+ * Fix some lintian errors in control file
+ * Fix piuparts reports on remaining dcmtk apache configuration file
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Tue, 31 May 2011 23:28:12 +0200
+
+dcmtk (3.6.0-5) unstable; urgency=low
+
+ * Fix invalid dep. to apache with apache2
+ * Remove explicit `invoke-rc.d dcmqrscp stop` since it makes package
+ un-removable. Let dh_installinit handles it
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Mon, 28 Mar 2011 15:33:06 +0200
+
+dcmtk (3.6.0-4) unstable; urgency=low
+
+ * new release fixes segfault. Closes: #615977
+ * Update README. Closes: #618686
+ * 3.6.0 is already packaged. Closes: #610855
+ * Update postrm script. Closes: #618688
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Thu, 17 Mar 2011 17:32:48 +0100
+
+dcmtk (3.6.0-3) unstable; urgency=low
+
+ * Properly conflict with dcmtk 3.5.4 and libdcmtk2
+ * Remove reference to issue with UNIX FHS
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Tue, 08 Mar 2011 17:14:24 +0100
+
+dcmtk (3.6.0-2) experimental; urgency=low
+
+ * Update copyright to reflects 3.6.0 changes
+ * Update dcmtk.NEWS to reflects 3.6.0 news
+ * Minor update to dcmtk.README.Debian for build instructions
+ * Minor cosmetic changes to the patch series
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Tue, 08 Feb 2011 19:20:13 +0100
+
+dcmtk (3.6.0-1) experimental; urgency=low
+
+ [ Mathieu Malaterre ]
+ * New upstream: 3.6.0
+ * Update SONAME to 2.0.0 because of change in log4cplus::Logger::addAppender
+ * Fix lintian errors on misc:Depends
+ * Fix lintian errors on init.d script
+ * Add a patch to link wth png/tiff libraries
+ * Update perl path patch
+ * debian/control: Update standards-version to 3.9.1
+ * Fix new naming convention for this release
+ * Add get-orig-source target in rules file
+ * Fix CHANGES numbering into something more flexible for later revs.
+ * Move *.dic file to the libdcmtk2 package
+ * Switch to dpkg-source 3.0 (quilt) format
+
+ [ Andreas Tille ]
+ * make sure *.dic file shwo up only in libdcmtk2 package
+ * Add -f to rm statement in clean target
+
+ -- Andreas Tille <tille@debian.org> Fri, 04 Feb 2011 22:24:40 +0100
+
+dcmtk (3.5.4-4) unstable; urgency=low
+
+ [Andreas Tille]
+ * Group maintenance according to Debian Med group policy
+ * Added myself as Uploader
+ * VCS fields
+ * Standards-Version: 3.8.3 (Added README.source)
+ * debhelper >= 7
+ * Add passive mode to watch file
+ * make use of dh_install
+ * debian/patches/05_no_www_docs.patch: Just do not install those
+ files we do not need in the docs of the package in the first
+ place instead of removing them later
+ * Removed some lintian warnings
+ * debian/patches/06_old_patches_from_diff_gz.patch: Move changes
+ from diff.gz to quilt patches
+ * Remove unused config files from previous versions according to
+ http://wiki.debian.org/DpkgConffileHandling
+ (The former handling in preinst triggered a lintian error)
+ * debian/dcmtk.NEWS: Reformating according to developers reference
+ 6.3.4. Supplementing changelogs with NEWS.Debian files
+ * debian/{01_buildsystem_changes,01_fix_perl_script_path,02_dcmtk_3.5.4-3}.patch
+ split up patches of former maintainer into maintainable pieces
+ * Build-Depends: graphviz
+ * debian/dot: Hack to enable png:gd graphics in doxygen which was
+ told to be more compact and readable. The hack contains also
+ working code to create SVG, but I failed to patch the HTML files
+ to render SVG files
+ * debian/libdcmtk1.lintian-overrides: we bundle more than
+ one library in this package so the warning is void
+ * debian/rules: Try to make backups of original files in config
+ but failed for two remaining files (no idea why)
+ * Move all files of dcmtk-www to /usr/lib/dcmtk/cgi-bin and
+ provide apache configuration which enable easy access via
+ http://localhost/dcmtk_wlm/
+ Closes: #553495
+
+ [Mathieu Malaterre]
+ * debian/rules would not honor DEB_BUILD_OPTIONS=nostrip, since
+ original Makefiles would hardcode call to `strip` directly
+ instead rely on dh_strip instead and remove direct call to
+ `strip` from Makefiles.
+ Closes: #511668, #436758
+
+ -- Andreas Tille <tille@debian.org> Wed, 02 Dec 2009 09:54:56 +0100
+
+dcmtk (3.5.4-3) unstable; urgency=low
+
+ * debian/control: Update standards-version to 3.7.2
+ * debian/dcmqrscp.init: Add LSB keyword section
+ * dcmnet/apps/{findscu,movescu}.cc: Apply patches in order
+ to fix --add-override-key bug (reported by Mike Miller
+ <mmiller3@iupui.edu>)
+ Closes: #429041
+ * debian/dcmtk.prerm: Stop dcmqrscp/imagectn more sanely
+ * debian/control: Replace ${Source-Version} by ${binary:Version}
+
+ -- Juergen Salk <jsa@debian.org> Sun, 22 Jul 2007 20:41:22 +0200
+
+dcmtk (3.5.4-2) unstable; urgency=low
+
+ * debian/control: Added build dependency on autotools-dev
+ * debian/rules: Modified clean target to put config.{sub,guess} below ./config
+ * dcmdata/libsrc/Makefile.in: Modified distclean target to delete dicom.tmp as well
+ * debian/rules: Fixed installation path for include files
+ * debian/dcmtk.postinst: Fixed add{user,group} options to reveal possible error msgs
+ (reported by Lars Wirzenius <liw@iki.fi>)
+ Closes: #353288
+ * debian/control: Removed 'Uploaders: field.
+ | From: Pablo Sau <psau@cadpet.es>
+ | Subject: Re: dcmtk
+ | Date: Thu, 19 Jan 2006 16:41:06 +0100
+ | To: Juergen Salk <jsa@debian.org>
+ | Hi Juergen:
+ | > I am still keeping you as an active co-maintainer for the Debian
+ | > dcmtk packages in the debian/control file. Would you mind, if I
+ | > drop your name from the control file in one of the next releases?
+ | >
+ | Of course, you must do it!
+ | Thanks for your support of dcmtk and best regards.
+ | Pablo
+
+ -- Juergen Salk <jsa@debian.org> Sun, 15 Jan 2006 17:31:38 +0000
+
+dcmtk (3.5.4-1) unstable; urgency=low
+
+ * New upstream release
+ * debian/dcmtk.NEWS: Added
+ * debian/copyright: Updated according to upstream's COPYRIGHT file
+ * debian/control: Unversioned build-dependency on libssl (now uses
+ OPENSSL_VERSION_NUMBER macro)
+ * debian/rules: Incremented SONAME version number (DcmFileFormat::loadFile changed)
+ * debian/rules: Changed dh_installinit --name argument to dcmqrscp
+ * debian/README.debian: Updated to reflect imagectn -> dcmqrscp transition
+ * debian/dcmtk.postinst: Added code for imagectn -> dcmqrscp transition
+ * debian/dcmtk.preinst: Created to handle imagectn -> dcmqrscp transition
+ * debian/dcmtk.postrm: Created to handle imagectn -> dcmqrscp transition
+ * debian/imagectn.init: Replaced by dcmqrscp.init
+ * debian/imagectn.default: Replaced by dcmqrscp.default
+ * debian/dcmtk.postinst: Added code to handle dcmtk user/group creation more sanely
+ * debian/control: Adjusted 'Maintainer:' field
+ * config/Makefile.def: Adjusted datadir and docdir
+ * dcmdata/libsrc/Makefile.in: Fixed bug for dicom.dic installation path
+ * dcmdata/apps/Makefile.in: Adjusted dcm2xml.dtd and dumppat.txt install paths
+ * dcmsr/apps/Makefile.in: Adjusted dsr2xml.xsd install path
+ * dcmwlm/perl/*.p[lh]: Adjusted perl hashbangs in CGI scripts
+ * dcmwlm/perl/prefs.ph: Adjusted cgi_path, html_path and data_path
+ * dcmqrdb/etc/dcmqrscp.cfg: Added UserName/GroupName config parameters
+ * dcmqrdb/etc/dcmqrscp.cfg: Commented out and adjusted example configuration
+ * dcmqrdb/docs/dcmqrcnf.txt: Adjusted UserName/GroupName examples
+ * dcmwlm/wlistdb/OFFIS: Added newline to prevent lintian "zero-bye" warning
+
+ -- Juergen Salk <jsa@debian.org> Tue, 20 Dec 2005 20:29:15 +0000
+
+dcmtk (3.5.3-5) unstable; urgency=low
+
+ * ./dcmsign/libsrc/sicert.cc: Constified d2i_X509 argument to fix build
+ problems with libssl-0.9.8
+ Closes: #335399
+ * debian/control: Versioned build-depend on libssl (>= 0.9.8-1)
+ * ./dcmnet/etc/storescp.cfg: Added missing Verification SOP Class
+
+ -- Juergen Salk <juergen.salk@gmx.de> Mon, 24 Oct 2005 20:16:56 +0000
+
+dcmtk (3.5.3-4) unstable; urgency=low
+
+ * debian/control: Added dependency on adduser for dcmtk package
+ * debian/control: Update Standards-Version to 3.6.2
+ * debian/{control,rules}: Renamed libdcmtk0 to libdcmtk0c2 (gcc/g++-4.0 transition)
+ * debian/control: Added Conflicts/Replaces with previous non-c2 version
+ * config/{configure.in,aclocal.m4,include/cfunix.h.in},
+ ofstd/libsrc/ofthread.cc: Backport HAVE_POINTER_TYPE_PTHREAD_T patch
+ from CVS version to fix build problems with gcc/g++-4.0
+
+ -- Juergen Salk <juergen.salk@gmx.de> Sun, 22 May 2005 22:02:31 +0200
+
+dcmtk (3.5.3-3) unstable; urgency=low
+
+ * debian/rules: Utilized binary-indep target for -doc package
+ (suggested by Marc 'HE' Brockschmidt <he@debian.org>)
+ * debian/rules: Introduced {build,install}-{indep,arch} targets
+ * debian/rules: Removed unneeded dh_* calls from binary-arch target
+ * Removed stale debian/*.install files
+
+ -- Juergen Salk <juergen.salk@gmx.de> Mon, 25 Apr 2005 20:13:09 +0200
+
+dcmtk (3.5.3-2) unstable; urgency=medium
+
+ * Added imagectn UserName/GroupName security patch
+ * Modified imagectn.cfg to reflect imagectn patch
+ * Modified debian/rules to create imagectn storage area
+ * Updated imagectn/docs/ctnconf.txt
+ * Fixed parser bug in CNF_readConfigLines()
+ (reported by R.M. Rutschmann <Roland.Rutschmann@psychologie.uni-regensburg.de>)
+ * Added debian/dcmtk.postinst script to create dcmtk system user/group
+ * Added debian/imagectn.init and debian/imagectn.default
+ (suggested by R.M. Rutschmann <Roland.Rutschmann@psychologie.uni-regensburg.de>)
+ * Updated debian/README.Debian
+ * Removed stale lintian override file
+ * Swapped 'Maintainer:' and 'Uploaders:' field
+ | From: Pablo Sau <psau@cadpet.es>
+ | Subject: Re: New (inofficial) dcmtk packages available
+ | Date: Thu, 31 Mar 2005 16:44:50 +0200
+ | > >> Why is Juergen "not official"?
+ | > > Historical reasons. It was Pablo who has filed the ITP for dcmtk
+ | > > initially. That's why we assigned maintainership to him for the
+ | > > first release.
+ | > If I understand Pablo right than he agreed that you will be put
+ | > in the Maintainer field. Pablo, correct me if I'm wrong.
+ | Yes of course,I filed the ITP for dcmtk initially but absolutely all
+ | work has been made by Juergen, so I think he must to be in the
+ | Maintainer field.
+ | Thanks Juergen for your great work and best regards to all of you.
+
+ -- Juergen Salk <juergen.salk@gmx.de> Sat, 19 Mar 2005 22:58:21 +0100
+
+dcmtk (3.5.3-1) unstable; urgency=low
+
+ * Initial Release.
+ Closes: #278914
+ * Adjusted toplevel Makefile and config/Makefile.def.in to fix $DESTDIR problems
+ * Fixed bug in config/configure.in for DCM_DICT_DEFAULT_PATH
+ * Modified dcmdata/libsrc/Makefile.in to adjust dicom.dic install path
+ * Modified dcmdata/apps/Makefile.in to adjust dcm2xml.dtd and dumppat.txt install paths
+ * Modified dcmsr/apps/Makefile.in to adjust dsr2xml.xsd install path
+ * Modified dcmwlm/Makefile.in to prevent wwwapps from being installed in ${bindir}.
+ * Set GENERATE_HTMLHELP = NO in doxygen/htmldocs to avoid index.hh?.gz cruft
+ * Adjusted hashbangs in dcmwlm/perl CGI scripts
+ * Adjusted cgi_path, html_path and data_path in dcmwlm/perl/prefs.ph
+ * Added newline in dcmwlm/wlistdb/OFFIS to prevent lintian "zero-bye" warning
+
+ -- Juergen Salk <juergen.salk@gmx.de> Sat, 30 Oct 2004 11:02:48 +0200
--- /dev/null
+Source: dcmtk
+Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org>
+Uploaders: Gert Wollny <gewo@debian.org>, Mathieu Malaterre <malat@debian.org>
+Section: science
+Priority: optional
+Build-Depends: cmake,
+ debhelper-compat (= 13),
+ dpkg-dev (>= 1.22.5),
+ gettext,
+ help2man,
+ libnsl-dev,
+ libpng-dev,
+ libsndfile1-dev,
+ libssl-dev,
+ libtiff-dev,
+ libwrap0-dev,
+ libxml2-dev,
+ xxd,
+ zlib1g-dev
+Build-Depends-Indep: doxygen, graphviz
+Standards-Version: 4.7.0
+Vcs-Browser: https://salsa.debian.org/med-team/dcmtk
+Vcs-Git: https://salsa.debian.org/med-team/dcmtk.git
+Homepage: https://dicom.offis.de/dcmtk
+Rules-Requires-Root: no
+
+Package: dcmtk
+Architecture: any
+Depends: adduser, ${misc:Depends}, ${shlibs:Depends}
+Description: OFFIS DICOM toolkit command line utilities
+ DCMTK includes a collection of libraries and applications for examining,
+ constructing and converting DICOM image files, handling offline media,
+ sending and receiving images over a network connection, as well as
+ demonstrative image storage and worklist servers.
+ .
+ This package contains the DCMTK utility applications.
+ .
+ Note: This version was compiled with libssl support.
+
+Package: dcmtk-data
+Architecture: all
+Multi-Arch: foreign
+Depends: ${misc:Depends}
+Description: OFFIS DICOM toolkit data files
+ DCMTK includes a collection of libraries and applications for examining,
+ constructing and converting DICOM image files, handling offline media,
+ sending and receiving images over a network connection, as well as
+ demonstrative image storage and worklist servers.
+ .
+ This package contains the DCMTK data files.
+
+Package: libdcmtk18
+Architecture: any
+Section: libs
+Depends: dcmtk-data (= ${source:Version}), ${misc:Depends}, ${shlibs:Depends}
+Breaks: libdcmtk16 (= 3.6.7-1)
+Replaces: libdcmtk16 (= 3.6.7-1)
+Multi-Arch: same
+Description: OFFIS DICOM toolkit runtime libraries
+ DCMTK includes a collection of libraries and applications for examining,
+ constructing and converting DICOM image files, handling offline media,
+ sending and receiving images over a network connection, as well as
+ demonstrative image storage and worklist servers.
+ .
+ This package contains the runtime libraries for the DCMTK utility
+ applications.
+ .
+ Note: This version was compiled with libssl support.
+
+Package: libdcmtk-dev
+Architecture: any
+Section: libdevel
+Depends: libdcmtk18 (= ${binary:Version}),
+ libnsl-dev,
+ libwrap0-dev,
+ libxml2-dev,
+ libz-dev,
+ ${misc:Depends}
+Suggests: dcmtk-doc
+Provides: libdcmtk18-dev
+Description: OFFIS DICOM toolkit development libraries and headers
+ DCMTK includes a collection of libraries and applications for examining,
+ constructing and converting DICOM image files, handling offline media,
+ sending and receiving images over a network connection, as well as
+ demonstrative image storage and worklist servers.
+ .
+ This package contains development libraries and headers for DCMTK. You
+ only need to install this if you are developing programs that use the
+ DCMTK libraries.
+ .
+ Note: This version was compiled with libssl support.
+
+Package: dcmtk-doc
+Architecture: all
+Section: doc
+Depends: libjs-jquery, ${misc:Depends}
+Suggests: dcmtk, libdcmtk-dev
+Multi-Arch: foreign
+Description: OFFIS DICOM toolkit documentation
+ DCMTK includes a collection of libraries and applications for examining,
+ constructing and converting DICOM image files, handling offline media,
+ sending and receiving images over a network connection, as well as
+ demonstrative image storage and worklist servers.
+ .
+ This package contains the on-line documentation for the DCMTK libraries
+ and utilities in HTML format.
--- /dev/null
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: DCMTK
+Upstream-Contact: DCMTK Team <info@dcmtk.org>
+Source: https://github.com/commontk/DCMTK
+
+Files: *
+Copyright: 1994-2019, OFFIS e.V.
+License: OFFISeV
+
+Files: dcmnet/include/dcmtk/dcmnet/dimse.h
+ dcmnet/include/dcmtk/dcmnet/assoc.h
+ dcmnet/include/dcmtk/dcmnet/dicom.h
+ dcmnet/include/dcmtk/dcmnet/dcompat.h
+ dcmnet/include/dcmtk/dcmnet/diutil.h
+ dcmnet/libsrc/dimstore.cc
+ dcmnet/libsrc/assoc.cc
+ dcmnet/libsrc/dulextra.cc
+ dcmnet/libsrc/dcompat.cc
+ dcmnet/libsrc/diutil.cc
+ dcmnet/libsrc/dimcmd.h
+ dcmnet/libsrc/dimfind.cc
+ dcmnet/libsrc/dimse.cc
+ dcmnet/libsrc/dimcmd.cc
+ dcmnet/libsrc/dimcancl.cc
+ dcmnet/libsrc/dimecho.cc
+ dcmnet/libsrc/dimmove.cc
+Copyright: 1993/1994, OFFIS, Oldenburg University and CERIUM
+License: OFFIS
+ This software and supporting documentation were
+ developed by
+ .
+ Institut OFFIS
+ Bereich Kommunikationssysteme
+ Westerstr. 10-12
+ 26121 Oldenburg, Germany
+ .
+ Fachbereich Informatik
+ Abteilung Prozessinformatik
+ Carl von Ossietzky Universitaet Oldenburg
+ Ammerlaender Heerstr. 114-118
+ 26111 Oldenburg, Germany
+ .
+ CERIUM
+ Laboratoire SIM
+ Faculte de Medecine
+ 2 Avenue du Pr. Leon Bernard
+ 35043 Rennes Cedex, France
+ .
+ for CEN/TC251/WG4 as a contribution to the Radiological
+ Society of North America (RSNA) 1993 Digital Imaging and
+ Communications in Medicine (DICOM) Demonstration.
+ .
+ THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER OFFIS,
+ OLDENBURG UNIVERSITY NOR CERIUM MAKE ANY WARRANTY REGARDING
+ THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR
+ FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER
+ DISEASES OR ITS CONFORMITY TO ANY SPECIFICATION. THE
+ ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF THE SOFTWARE
+ IS WITH THE USER.
+ .
+ Copyright of the software and supporting documentation
+ is, unless otherwise stated, jointly owned by OFFIS,
+ Oldenburg University and CERIUM and free access is hereby
+ granted as a license to use this software, copy this
+ software and prepare derivative works based upon this
+ software. However, any distribution of this software
+ source code or supporting documentation or derivative
+ works (source code and supporting documentation) must
+ include the three paragraphs of this copyright notice.
+
+Files: dcmnet/include/dcmtk/dcmnet/dul.h
+ dcmnet/include/dcmtk/dcmnet/dulstruc.h
+ dcmnet/libsrc/dul.cc
+ dcmnet/libsrc/dulconst.cc
+ dcmnet/libsrc/dulpriv.h
+ dcmnet/libsrc/dulpres.cc
+ dcmnet/libsrc/dulfsm.h
+ dcmnet/libsrc/dulfsm.cc
+ dcmnet/libsrc/dulparse.cc
+Copyright: 1993, 1994 RSNA and Washington University
+ 1994-2021, OFFIS e.V.
+License: RSNA
+ The software and supporting documentation for the Radiological
+ Society of North America (RSNA) 1993, 1994 Digital Imaging and
+ Communications in Medicine (DICOM) Demonstration were developed
+ at the
+ Electronic Radiology Laboratory
+ Mallinckrodt Institute of Radiology
+ Washington University School of Medicine
+ 510 S. Kingshighway Blvd.
+ St. Louis, MO 63110
+ as part of the 1993 DICOM Central Test Node project for, and
+ under contract with, the Radiological Society of North America.
+ .
+ THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND NEITHER RSNA NOR
+ WASHINGTON UNIVERSITY MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS
+ PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+ USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY
+ SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF
+ THE SOFTWARE IS WITH THE USER.
+ .
+ Copyright of the software and supporting documentation is
+ jointly owned by RSNA and Washington University, and free access
+ is hereby granted as a license to use this software, copy this
+ software and prepare derivative works based upon this software.
+ However, any distribution of this software source code or
+ supporting documentation or derivative works (source code and
+ supporting documentation) must include the three paragraphs of
+ the copyright notice.
+
+Files: dcmjpeg/libijg8/*
+ dcmjpeg/libijg12/*
+ dcmjpeg/libijg16/*
+Copyright: 1991-1998, Thomas G. Lane.
+License: JPEG
+ The authors make NO WARRANTY or representation, either express or implied,
+ with respect to this software, its quality, accuracy, merchantability, or
+ fitness for a particular purpose. This software is provided "AS IS", and you,
+ its user, assume the entire risk as to its quality and accuracy.
+ .
+ Permission is hereby granted to use, copy, modify, and distribute this
+ software (or portions thereof) for any purpose, without fee, subject to these
+ conditions:
+ (1) If any part of the source code for this software is distributed, then this
+ README file must be included, with this copyright and no-warranty notice
+ unaltered; and any additions, deletions, or changes to the original files
+ must be clearly indicated in accompanying documentation.
+ (2) If only executable code is distributed, then the accompanying
+ documentation must state that "this software is based in part on the work of
+ the Independent JPEG Group".
+ (3) Permission for use of this software is granted only if the user accepts
+ full responsibility for any undesirable consequences; the authors accept
+ NO LIABILITY for damages of any kind.
+ .
+ These conditions apply to any software derived from or based on the IJG code,
+ not just to the unmodified library. If you use our work, you ought to
+ acknowledge us.
+ .
+ Permission is NOT granted for the use of any IJG author's name or company name
+ in advertising or publicity relating to this software or products derived from
+ it. This software may be referred to only as "the Independent JPEG Group's
+ software".
+ .
+ We specifically permit and encourage the use of this software as the basis of
+ commercial products, provided that all warranty or liability claims are
+ assumed by the product vendor.
+
+Files: dcmimage/include/dcmtk/dcmimage/diqtpix.h
+Copyright: 1991 by Jef Poskanzer.
+License: pbmplus
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose and without fee is hereby granted, provided
+ that the above copyright notice appear in all copies and that both that
+ copyright notice and this permission notice appear in supporting
+ documentation. This software is provided "as is" without express or
+ implied warranty.
+Comment: The code for the interpolatePixel() image scaling algorithm in module
+ dcmimgle has been derived from code written by Jef Poskanzer for the
+ "Extended Portable Bitmap Toolkit" (pbmplus10dec91)
+
+Files: ofstd/libsrc/ofstd.cc
+Copyright: 2001-2017 OFFIS e.V.
+ 1998 Todd C. Miller <Todd.Miller(at)courtesan.com>
+ 1988 Regents of the University of California
+ 1999 Bob Withers <bwit@pobox.com>
+License: OFFISeV
+
+Files: oflog/*
+Copyright: 1999-2009 Contributors to log4cplus project.
+License: BSD-2-clause
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+ .
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ .
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ .
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Files: oflog/include/dcmtk/oflog/config/macosx.h
+Copyright: 2003-2010 Christopher R. Bailey
+License: Apache-2.0
+
+Files: oflog/include/dcmtk/oflog/windebap.h
+ oflog/libsrc/windebap.cc
+Copyright: 2003-2010 Eduardo Francos, Odalio SARL
+License: Apache-2.0
+
+Files: oflog/libsrc/clogger.cc
+ oflog/include/dcmtk/oflog/clogger.h
+Copyright: 2011 Jens Rehsack and Tad E. Smith
+License: Apache-2.0
+
+Files: oflog/include/dcmtk/oflog/ntelogap.h
+ oflog/libsrc/ntelogap.cc
+Copyright: 2003-2010 Michael CATANZARITI
+License: Apache-2.0
+
+Files: oflog/include/dcmtk/oflog/log4judp.h
+ oflog/libsrc/log4judp.cc
+Copyright: 2012 Siva Chandran P
+License: Apache-2.0
+
+Files: config/stdcxx.m4
+Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com>
+ 2012 Zack Weinberg <zackw@panix.com>
+ 2013 Roy Stogner <roystgnr@ices.utexas.edu>
+ 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
+ 2015 Paul Norman <penorman@mac.com>
+ 2015 Moritz Klammler <moritz@klammler.eu>
+ 2016 Krzesimir Nowak <qdlacz@gmail.com>
+License: stdcxx-m4
+ Copying and distribution of this file, with or without modification, are
+ permitted in any medium without royalty provided the copyright notice
+ and this notice are preserved. This file is offered as-is, without any
+ warranty.
+
+Files: oflog/include/dcmtk/oflog/appender.h
+ oflog/include/dcmtk/oflog/config/win32.h
+ oflog/include/dcmtk/oflog/configrt.h
+ oflog/include/dcmtk/oflog/consap.h
+ oflog/include/dcmtk/oflog/fileap.h
+ oflog/include/dcmtk/oflog/fstreams.h
+ oflog/include/dcmtk/oflog/helpers/apndimpl.h
+ oflog/include/dcmtk/oflog/helpers/lloguser.h
+ oflog/include/dcmtk/oflog/helpers/loglog.h
+ oflog/include/dcmtk/oflog/helpers/pointer.h
+ oflog/include/dcmtk/oflog/helpers/property.h
+ oflog/include/dcmtk/oflog/helpers/sleep.h
+ oflog/include/dcmtk/oflog/helpers/sockbuff.h
+ oflog/include/dcmtk/oflog/helpers/socket.h
+ oflog/include/dcmtk/oflog/helpers/strhelp.h
+ oflog/include/dcmtk/oflog/helpers/threadcf.h
+ oflog/include/dcmtk/oflog/helpers/timehelp.h
+ oflog/include/dcmtk/oflog/hierarchy.h
+ oflog/include/dcmtk/oflog/hierlock.h
+ oflog/include/dcmtk/oflog/layout.h
+ oflog/include/dcmtk/oflog/logger.h
+ oflog/include/dcmtk/oflog/loglevel.h
+ oflog/include/dcmtk/oflog/logmacro.h
+ oflog/include/dcmtk/oflog/ndc.h
+ oflog/include/dcmtk/oflog/nullap.h
+ oflog/include/dcmtk/oflog/socketap.h
+ oflog/include/dcmtk/oflog/spi/apndatch.h
+ oflog/include/dcmtk/oflog/spi/factory.h
+ oflog/include/dcmtk/oflog/spi/filter.h
+ oflog/include/dcmtk/oflog/spi/logevent.h
+ oflog/include/dcmtk/oflog/spi/logfact.h
+ oflog/include/dcmtk/oflog/spi/logimpl.h
+ oflog/include/dcmtk/oflog/spi/objreg.h
+ oflog/include/dcmtk/oflog/spi/rootlog.h
+ oflog/include/dcmtk/oflog/streams.h
+ oflog/include/dcmtk/oflog/syslogap.h
+ oflog/include/dcmtk/oflog/thread/impl/thredimp.h
+ oflog/include/dcmtk/oflog/thread/threads.h
+ oflog/include/dcmtk/oflog/tstring.h
+ oflog/libsrc/apndimpl.cc
+ oflog/libsrc/appender.cc
+ oflog/libsrc/config.cc
+ oflog/libsrc/consap.cc
+ oflog/libsrc/factory.cc
+ oflog/libsrc/fileap.cc
+ oflog/libsrc/filter.cc
+ oflog/libsrc/globinit.cc
+ oflog/libsrc/hierarchy.cc
+ oflog/libsrc/hierlock.cc
+ oflog/libsrc/layout.cc
+ oflog/libsrc/lloguser.cc
+ oflog/libsrc/logevent.cc
+ oflog/libsrc/logger.cc
+ oflog/libsrc/logimpl.cc
+ oflog/libsrc/loglevel.cc
+ oflog/libsrc/loglog.cc
+ oflog/libsrc/ndc.cc
+ oflog/libsrc/nullap.cc
+ oflog/libsrc/objreg.cc
+ oflog/libsrc/patlay.cc
+ oflog/libsrc/pointer.cc
+ oflog/libsrc/property.cc
+ oflog/libsrc/rootlog.cc
+ oflog/libsrc/sleep.cc
+ oflog/libsrc/sockbuff.cc
+ oflog/libsrc/socket.cc
+ oflog/libsrc/socketap.cc
+ oflog/libsrc/strhelp.cc
+ oflog/libsrc/syslogap.cc
+ oflog/libsrc/threads.cc
+ oflog/libsrc/timehelp.cc
+ oflog/libsrc/unixsock.cc
+ oflog/libsrc/winsock.cc
+Copyright: 2001-2010 Tad E. Smith
+License: Apache-2.0
+
+Files: oflog/include/dcmtk/oflog/tracelog.h
+ oflog/libsrc/logmacro.cc
+Copyright: 2010 Vaclav Haisman
+License: Apache-2.0
+
+Files: dcmjpls/libcharls/*
+Copyright: 2007-2010, Jan de Vaan
+License: BSD-3-clause
+
+Files: ofstd/tests/tstring.cc
+Copyright: 1997-2011, OFFIS e.V.
+ 1994 Free Software Foundation
+License: GPL-2.0+
+ All rights reserved. See COPYRIGHT file for details.
+ .
+ This software and supporting documentation were developed by
+ .
+ OFFIS e.V.
+ R&D Division Health
+ Escherweg 2
+ D-26121 Oldenburg, Germany
+ .
+ This file is part of the GNU ANSI C++ Library. This library is free
+ software; you can redistribute it and/or modify it under the terms of
+ the GNU General Public License as published by the Free Software
+ Foundation; either version 2, or (at your option) any later version.
+ .
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING, if not, see
+ <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General Public License
+ version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
+Files: debian/*
+Copyright: 2005-2011 Juergen Salk <juergen.salk@gmx.de> on
+ 2011-2014 Mathieu Malaterre <malat@debian.org>
+ 2014-2015 Andreas Tille <tille@debian.org>
+ 2015-2018 Gert Wollny <gw.fossdev@gmail.com>
+License: BSD-3-clause
+
+Files: ofstd/include/dcmtk/ofstd/ofxml.h
+ ofstd/libsrc/ofxml.cc
+Copyright: 2002, Frank Vanden Berghen
+License: dcmtk-or-AFPL
+ The following license terms apply to projects that are in some way related to
+ the "DCMTK project", including applications
+ using "DCMTK project" and tools developed
+ for enhancing "DCMTK project". All other projects
+ (not related to "DCMTK project") have to use this
+ code under the Aladdin Free Public License (AFPL)
+ See the file "AFPL-license.txt" for more information about the AFPL license.
+ (see http://www.artifex.com/downloads/doc/Public.htm for detailed AFPL terms)
+ .
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Frank Vanden Berghen nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+ THIS SOFTWARE IS PROVIDED BY Frank Vanden Berghen ``AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Files: dcmrt/*
+Copyright: 2008-2012, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
+ 2013-2021, J. Riesmeier, Oldenburg, Germany
+License: BSD-3-clause-Riesmeier
+
+Files: dcmsr/include/dcmtk/dcmsr/dsrdncsr.h
+ dcmsr/include/dcmtk/dcmsr/dsrsaecc.h
+ dcmsr/libsrc/dsrdncsr.cc
+ dcmsr/libsrc/dsrsaecc.cc
+ dcmsr/include/dcmtk/dcmsr/cmr/tid1419m.h
+ dcmsr/include/dcmtk/dcmsr/cmr/tid1501.h
+ dcmsr/include/dcmtk/dcmsr/cmr/tid15def.h
+ dcmsr/include/dcmtk/dcmsr/cmr/tid300.h
+ dcmsr/include/dcmtk/dcmsr/dsrdnflt.h
+ dcmsr/include/dcmtk/dcmsr/dsritcsr.h
+ dcmsr/include/dcmtk/dcmsr/dsrprdcc.h
+ dcmsr/include/dcmtk/dcmsr/dsrpficc.h
+ dcmsr/libsrc/dsrpficc.cc
+ dcmsr/libsrc/dsrplicc.cc
+ dcmsr/libcmr/tid1419m.cc
+ dcmsr/libcmr/tid1501.cc
+ dcmsr/libcmr/tid15def.cc
+ dcmsr/libsrc/dsrdnflt.cc
+ dcmsr/libsrc/dsritcsr.cc
+ dcmsr/libsrc/dsrprdcc.cc
+Copyright: 2016-2021, J. Riesmeier, Oldenburg, Germany
+License: OFFISeV
+
+Files: dcmect/include/dcmtk/dcmect/def.h
+ dcmect/include/dcmtk/dcmect/enhanced_ct.h
+ dcmect/include/dcmtk/dcmect/types.h
+ dcmect/libsrc/enhanced_ct.cc
+ dcmect/libsrc/types.cc
+Copyright: 2019 Open Connections GmbH
+License: OFFISeV
+
+Files: dcmrt/include/dcmtk/dcmrt/drttypes.h
+ dcmrt/libsrc/drttypes.cc
+ dcmrt/libsrc/drtbvcps.cc
+ dcmrt/libsrc/drtmas.cc
+Copyright: 2008-2012, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
+ 2013-2019, J. Riesmeier, Oldenburg, Germany
+License: BSD-3-clause-Riesmeier
+
+
+Files: dcmrt/include/dcmtk/dcmrt/drmdose.h
+ dcmrt/include/dcmtk/dcmrt/drmsrch.h
+ dcmrt/include/dcmtk/dcmrt/drmstrct.h
+ dcmrt/include/dcmtk/dcmrt/drmplan.h
+ dcmrt/libsrc/drmimage.cc
+ dcmrt/libsrc/drmplan.cc
+ dcmrt/libsrc/drmstrct.cc
+ dcmrt/tests/tsearch.cc
+Copyright: 2012, OFFIS e.V.
+License: OFFISeV
+
+Files: dcmrt/libsrc/drmdose.cc
+Copyright: 2012-2015, OFFIS e.V.
+License: OFFISeV
+
+Files: dcmrt/include/dcmtk/dcmrt/drmimage.h
+ dcmrt/tests/tests.cc
+Copyright: 2012-2016, OFFIS e.V.
+License: OFFISeV
+
+Files: dcmfg/include/dcmtk/dcmfg/fgframeanatomy.h
+ dcmfg/include/dcmtk/dcmfg/fgpixeltransform.h
+ dcmfg/include/dcmtk/dcmfg/fgparametricmapframetype.h
+ dcmfg/libsrc/fgframeanatomy.cc
+ dcmfg/libsrc/fgpixeltransform.cc
+ dcmfg/libsrc/fgparametricmapframetype.cc
+ dcmiod/include/dcmtk/dcmiod/iodcontentitemmacro.h
+ dcmiod/include/dcmtk/dcmiod/iodreferences.h
+ dcmiod/include/dcmtk/dcmiod/modfloatingpointimagepixel.h
+ dcmiod/include/dcmtk/dcmiod/modimagepixelbase.h
+ dcmiod/include/dcmtk/dcmiod/modimagepixelvariant.h
+ dcmiod/libsrc/iodcontentitemmacro.cc
+ dcmiod/libsrc/iodreferences.cc
+ dcmiod/libsrc/modfloatingpointimagepixel.cc
+ dcmiod/libsrc/modimagepixelbase.cc
+ dcmdata/tests/tnewdcme.cc
+Copyright: Copyright (C) 2017, Open Connections GmbH
+License: OFFISeV
+
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ .
+ http://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ .
+ On Debian GNU/Linux systems you can find this license under
+ /usr/share/common-licenses/Apache-2.0
+
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+ *
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+License: BSD-3-clause-Riesmeier
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ .
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ .
+ * Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+License: OFFISeV
+ This software and supporting documentation were developed by
+ .
+ OFFIS e.V.
+ R&D Division Health
+ Escherweg 2
+ 26121 Oldenburg, Germany
+ .
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ - Neither the name of OFFIS nor the names of its contributors may be
+ used to endorse or promote products derived from this software
+ without specific prior written permission.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null
+# Run dcmqrscp at startup ?
+DCMQRSCP_ENABLE=No
+
--- /dev/null
+#! /bin/sh
+#
+# Start script for dcmqrscp from dcmtk-package
+# Adapted from skeleton
+# @(#)skeleton 2.85-23 28-Jul-2004 miquels@cistron.nl
+# by Roland Marcus Rutschmann <rudi@debian.org>
+# and Juergen Salk <juergen.salk@gmx.de>
+# Version 0.2 Sun, 22 Jul 2007 21:32:42 +0200
+### BEGIN INIT INFO
+# Provides: dcmqrscp
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop: $network $local_fs $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Init-Script for DCMTK Central Test Node dcmqrscp
+### END INIT INFO
+
+
+set -e
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="DCMTK Central Test Node"
+NAME=dcmqrscp
+DAEMON=/usr/bin/$NAME
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+DCMQRSCP_CFG="/etc/dcmtk/dcmqrscp.cfg"
+
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
+# Read config file if it is present.
+if [ -r /etc/default/$NAME ]
+then
+ . /etc/default/$NAME
+fi
+
+case "$DCMQRSCP_ENABLE" in
+ [Nn]*)
+ exit 0
+ ;;
+esac
+
+
+#
+# Function that starts the daemon/service.
+#
+d_start() {
+ start-stop-daemon --start --quiet --background \
+ --make-pidfile --pidfile $PIDFILE \
+ --exec $DAEMON -- +ac -c $DCMQRSCP_CFG
+}
+
+#
+# Function that stops the daemon/service.
+#
+d_stop() {
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+ --name $NAME
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ d_start
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: $NAME"
+ d_stop
+ echo "."
+ ;;
+ reload)
+ exit 0
+ ;;
+ restart|force-reload)
+ echo -n "Restarting $DESC: $NAME"
+ d_stop
+ sleep 1
+ d_start
+ echo "."
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+usr/share/dcmtk/*.dic
+usr/share/dcmtk/csmapper/
+usr/share/dcmtk/esdb/
--- /dev/null
+Document: dcmtk-doc
+Title: Documentation of DCMTK
+Author: OFFIS DICOM Team <dicom@offis.de>
+Abstract: This manual comprises the complete on-line documentation for the
+ DICOM ToolKit (DCMTK) packages. It covers the end user applications as well
+ as the development library interfaces including a wide variety of coding
+ examples.
+Section: Science/Medicine
+
+Format: HTML
+Index: /usr/share/doc/dcmtk/dcmtk-3.6.8/html/index.html
+Files: /usr/share/doc/dcmtk/dcmtk-3.6.8/html/*
--- /dev/null
+usr/share/doc/dcmtk-*/
--- /dev/null
+dcmtk (3.6.0-1) unstable; urgency=low
+
+ Version 3.6.0 of the OFFIS DCMTK (DICOM ToolKit) software is now available for
+ public release. This release includes the following main changes over the
+ previous version 3.5.4:
+
+ - DCMTK 3.6.0 now also builds correctly with GNU gcc 4.1 (and higher), Visual
+ Studio 2008 and 2010.
+
+ - Tested with latest versions of the following operating systems/environments:
+
+ - Linux on x86 and x86_64
+ - FreeBSD on x86 and x86_64
+ - MacOS X on x86_64
+ - Windows on x86 and x86_64
+ - Cygwin and MinGW/MSys on x86
+
+ For a complete list of tested systems and compilers, see the INSTALL file.
+
+ - The CMake build system can now also be used with other operating systems than
+ Windows. However, GNU autoconf is still supported and should be preferred on
+ systems where the CMake project files fail.
+
+ - New module oflog introduces a unified DCMTK-wide approach for logging based
+ on the log4cplus library. Direct output to console, file, syslog and event
+ log. All DCMTK command line tools now have the same set of logging options.
+
+ - New module dcmjpls adds support for JPEG-LS compressed DICOM images based on
+ the CharLS library. The tools dcmcjpls and dcmdjpls allow for compressing
+ and decompressing DICOM images with JPEG-LS from the command line.
+
+ - New tool img2dcm allows for converting JPEG and BMP images to various DICOM
+ image IODs, e.g. old and new Secondary Capture, Visible Light Photographic.
+ The underlying C++ class library can also be used separately.
+
+ - New tool dcm2pdf allows for extracting PDF files from DICOM Encapsulated PDF
+ Storage SOP instances.
+
+ - New tool dcml2pnm allows for converting JPEG-LS compressed DICOM images to
+ standard image formats like TIFF or BMP.
+
+ - The tools dcmdump and storescu have new options for searching directories
+ recursively for DICOM files.
+
+ - The tool dcmdump now also has a colored output of the textual dump. So far,
+ this option is available on non-Windows systems only (uses ANSI escape code).
+
+ - The tool dcmodify now also supports reading the value of insert and modify
+ statements from a file. This is especially useful for large element values.
+
+ - The tool dsr2html now also supports the output in HTML 4.01 and XHTML 1.1
+ format. There are also new options that affect the rendering result.
+
+ - The tool dump2dcm now also supports compressed pixel data. In addition,
+ the memory requirements for very large data elements have been reduced.
+
+ - The tool xml2dcm can now also read binary data (e.g. pixel data) from a
+ separate file. The corresponding feature is not yet available in dcm2xml.
+
+ - The tool storescp now has a new option that allows for accepting all
+ supported transfer syntaxes on a single association.
+
+ - The tool wlmscpfs now supports multi-process mode both on Posix and Windows
+ platforms where a new child process is created for each incoming association.
+
+ - Refactored code of the tool findscu into a C++ class. This facilitates
+ re-use of the findscu code in other applications.
+
+ - Added further "switches" to the dcmdata module which allow one to better cope
+ with incorrectly encoded DICOM files or datasets. These switches are also
+ available as new options to the tools dcmdump and dcmconv.
+
+ - The dcmdata module now also gives access to partial attribute values without
+ loading the complete attribute value into memory, if kept in file.
+
+ - The write methods in dcmdata now handle large raw data elements without
+ loading everything into memory. This allows very large images to be sent
+ over a network connection or to be copied without ever being fully in memory.
+
+ - The dcmdata module now has a common interface for the frame-wise access to
+ compressed and uncompressed pixel data without ever loading the complete
+ object into main memory.
+
+ - The dcmimgle/dcmimage module makes use of the new partial access to pixel
+ data for processing large multi-frame images in a stepwise manner.
+
+ - The dcmimgle/dcmimage module and related tools now also support a new
+ bilinear and a bicubic scaling algorithm for image magnification.
+ Furthermore, the sigmoid VOI LUT function has been implemented.
+
+ - Added support for Colon CAD SR, Spectacle Prescription Report, Macular Grid
+ Thickness and Volume Report as well as Implantation Plan SR documents to the
+ dcmsr module.
+
+ - Incorporated fixes to dcmsr module which were introduced by various
+ correction proposals. Added support for the new optional Preliminary Flag.
+
+ - DICOMDIR tools and classes now support all new SOP classes and directory
+ record types. Also added a new operating mode that allows for updating
+ existing entries in a DICOMDIR.
+
+ - Introduced general path syntax for accessing nested elements from command
+ line tools like findscu or dcmodify.
+
+ - Added methods for checking the value representation (VR) and value
+ multiplicity (VM) of data elements for conformance with the DICOM standard.
+
+ - Network tools now support transmission and receipt of JPEG-LS and MPEG2
+ transfer syntaxes.
+
+ - Added support for the extended negotiation of user identity to the dcmnet
+ module. The first tool that makes use of this new feature is storescu.
+
+ - Introduced new experimental SCU and SCP classes that act as a C++ wrapper to
+ the still C-based dcmnet module.
+
+ - Added new class OFFile that provides a simple encapsulation layer for file
+ based stream I/O and, in particular, provides large file support (LFS) if
+ available on the underlying operating system/platform through a single API.
+
+ - Out of the box compilation with OpenSSL 1.0.0 is now supported.
+
+ - Revised installation directory scheme in order to be more compliant with the
+ Filesystem Hierarchy Standard (FHS) and derived file system standards.
+
+ - Added data dictionary including private ASTM tags from DICONDE (Digital
+ Imaging and Communication in Nondestructive Evaluation) standard.
+
+ - The DICOM data dictionary as well as the list of SOP classes and transfer
+ syntaxes have been re-worked based on the latest edition of the DICOM
+ standard plus all additionally approved supplements and correction proposals
+ (as of 2010-11-30). Please note that there have been minor name changes!
+
+ - Many bug fixes and minor improvements as usual - see the more than 12,000
+ lines long CHANGES.360 file for more details.
+
+ -- Mathieu Malaterre <mathieu.malaterre@gmail.com> Tue, 08 Feb 2011 19:14:53 +0100
--- /dev/null
+DCMTK - The OFFIS DICOM ToolKit for Debian
+==========================================
+
+General notes:
+
+DCMTK is a collection of libraries and applications implementing large
+parts the DICOM standard. It includes software for examining,
+constructing and converting DICOM image files, handling offline media,
+sending and receiving images over a network connection, as well as
+demonstrative image storage and worklist servers. DCMTK is written
+in a mixture of ANSI C and C++. It comes in complete source code and
+is made available as "open source" software under BSD like license
+terms. For additional information about DCMTK have a look at the
+OFFIS web page:
+
+ http://dicom.offis.de/dcmtk.php.en
+
+DCMTK has been used at numerous DICOM demonstrations to provide
+central, vendor-independent image storage and worklist servers (CTNs -
+Central Test Nodes). It is used by hospitals and companies all over
+the world for a wide variety of purposes ranging from being a tool for
+product testing to being a building block for research projects,
+prototypes and commercial products.
+
+DCMTK optionally supports some of the DICOM security extensions and
+relies on the free OpenSSL toolkit for the underlying cryptographic
+routines and the TLS protocol implementation. The Debian DCMTK package
+has been built with OpenSSL support enabled.
+
+More information about using the DCMTK network applications for secure
+DICOM communication can be found in
+
+ /usr/share/docs/dcmtk/ciphers.txt
+ /usr/share/docs/dcmtk/randseed.txt
+
+DCMTK optionally supports Wietse Venema's TCP wrappers library
+(libwrap) which is freely available for most Unix platforms and part
+of the default installation of most recent Linux distributions. This
+library allows one to enforce host-based access control via the
+"/etc/hosts_deny" and "/etc/hosts_allow" configuration files. The
+Debian DCMTK package has been compiled with TCP wrapper support
+enabled. See hosts_access(5) man page for details.
+
+You can use the dcmnet applications for testing DICOM connectivity. A
+brief description can be found in
+
+ /usr/share/docs/dcmtk/testing.txt
+
+
+The DCMTK dcmqrscp application implements a DICOM image
+storage/query/retrieve SCP which has been designed primarily as an
+independent framework for cooperative tests and demonstrations of
+DICOM connectivity by medical imaging vendors. If you want to set up
+dcmqrdb as a DICOM image storage server please read both the dcmqrscp
+manual pages and the supplemental documentation in
+
+ /usr/share/doc/dcmtk/dcmqrcnf.txt
+ /usr/share/doc/dcmtk/dcmqrset.txt
+
+The dcmqrscp application can be invoked as a daemon process at boot
+time by setting DCMQRSCP_ENABLE=Yes in /etc/defaults/dcmqrscp. You will
+have to adjust the system wide configuration file
+/etc/dcmtk/dcmqrscp.cfg to suit your needs. This configuration file
+provides optional UserName/GroupName keywords in the "Global
+Parameter" section (see note in dcmqrcnf.txt). Running dcmqrscp with
+root privileges is strongly discouraged. A dedicated system
+user/group dcmtk/dcmtk is automatically added during the installation
+of the Debian DCMTK package. It is important to note that dcmqrscp is
+primarily intended to be used as a demonstration server rather than a
+real "PACS replacement". Scalability is quite limited, both in terms
+of number of images/studies and in number of parallel clients. If you
+want to set up a real large database, you might be better off in using
+an SQL based archive (such as the Mallinckrodt CTN).
+
+
+DCMTK supports the Modality Worklist Management SOP Class as a SCP, which
+allows modalities to query and retrieve worklist information from hospital
+information systems. An example worklist database along with a set of
+example queries can be found in
+
+ /usr/share/doc/dcmtk/examples/wlistdb
+
+and
+
+ /usr/share/doc/dcmtk/examples/wlistqry.
+
+Here is a brief instruction about how to make this work (based on a post
+of Thomas Wilkens in comp.protocols.dicom):
+
+1. Use dump2dcm to convert all "*.dump" files in examples/wlistdb/OFFIS
+to "*.wl" files (DICOM format):
+
+ $ for f in *.dump; do dump2dcm "$f" "${f%.dump}".wl; done
+
+Note that these files have to have the extension "*.wl", otherwise wlmscpfs
+will not find these files. These files represent your worklist database.
+2. Use dump2dcm to convert all "*.dump" files in examples/wlistqry to
+"*.dcm" files (DICOM format):
+
+ $ for f in *.dump; do dump2dcm "$f" "${f%.dump}".dcm; done
+
+These files represent possible queries that can be used to query the worklist
+database.
+3. In one shell run the following command to start the worklist management SCP:
+
+ $ wlmscpfs -v -dfp examples/wlistdb 1234
+
+4. In another shell run the following command to send a certain query to the
+WLM SCP:
+
+ $ findscu -v --call OFFIS localhost 1234 examples/wlistqry/wlistqry0.dcm
+
+Step 3 will start the worklist management SCP which will listen on port 1234
+for incoming C-FIND RQ messages. The "-dfp examples/wlistdb" option
+specifies that the worklist database can be found in folder "examples/wlistdb".
+Note that the worklist database can be organized in different storage areas.
+Subfolder "OFFIS" below "examples/wlistdb" is one (the only one in this case)
+storage area. In an incoming C-FIND RQ, an SCU has to tell wlmscpfs which
+storage area shall be queried; this is done by sending a certain "called AE title"
+to wlmscpfs.
+
+Step 4 will send the query in file "examples/wlistqry/wlistqry0.dcm"
+using a C-FIND-RQ message to the wlmscpfs application (which is running on
+"localhost" and listening on port "1234"). Option "--call OFFIS" specifies
+that the called AE title is "OFFIS" which in turn tells the wlmscpfs
+application to query the storage area "OFFIS" in its worklist database.
+
+The two programs should then dump information that shows their internal
+processings (C-FIND RQ - C-FIND RSP). You can also use a different query
+file in folder "examples/wlistqry" for querying the worklist database.
+
+As the wlmscpfs is not a hospital information system, worklist entries
+must be created, updated and deleted manually. The Debian dcmtk-www
+package contains a cgi-based WWW server application which provides an easy
+to use web interface for managing worklist entries from any workstation
+in the network. More information about the DCMTK worklist web interface can
+be found in
+
+ /usr/share/doc/dcmtk-www/wwwapp.txt
+
+
+For more information please visit the DCMTK homepage and the user forum at
+
+ http://dicom.offis.de/dcmtk.php.en
+
+and
+
+ http://forum.dcmtk.org/
+
+---
+
+DCMTK on Debian is either build using ICU or stdlibc (iconv) to support
+CharacterSet in DICOM. However full support for CharacterSet is only
+implemented in libiconv. Since Debian does not ship libiconv, user may get the
+following error message for the non-supported CharacterSet (ISO 2022 IR 87 in
+this case):
+
+E: DcmSpecificCharacterSet: 'ISO 2022 IR 87' is not supported by the utilized
+ character set conversion library 'ICU, Version 63.1.0'
+
+or
+
+E: DcmSpecificCharacterSet: 'ISO 2022 IR 87' is not supported by the utilized
+ character set conversion library 'GNU C library (iconv), version 2.28'
+
+ -- Mathieu Malaterre <malat@debian.org> Thu, 20 May 2021 11:36:10 +0200
--- /dev/null
+/var/lib/dcmtk/db
--- /dev/null
+FAQ
+README
+debian/NEWS
--- /dev/null
+usr/share/dcmtk/wlistdb
+usr/share/dcmtk/wlistqry
--- /dev/null
+etc/dcmtk/*
+usr/bin/*
+usr/share/dcmtk/*.css
+usr/share/dcmtk/*.dump
+usr/share/dcmtk/*.lut
+usr/share/dcmtk/dcm2xml.dtd
+usr/share/dcmtk/dsr2xml.xsd
+usr/share/dcmtk/dumppat.txt
--- /dev/null
+rm_conffile /etc/default/dcmqrscp
+rm_conffile /etc/default/storescp
+rm_conffile /etc/init.d/dcmqrscp
+rm_conffile /etc/init.d/storescp
--- /dev/null
+usr/share/man/man1/*.1
--- /dev/null
+#!/bin/sh
+
+set -e
+
+# Create dcmtk user and group
+
+if ! getent passwd dcmtk >/dev/null 2>&1; then
+ if ! getent group dcmtk > /dev/null 2>&1; then
+ echo "Adding \`dcmtk' group to system ..."
+ addgroup --quiet --system dcmtk || true
+ fi
+ echo "Adding \`dcmtk' user to system ..."
+ adduser --quiet --system --ingroup dcmtk --home /var/lib/dcmtk/db \
+ --shell /usr/sbin/nologin dcmtk || true
+fi
+
+# work around possible adduser bug, see #119366
+[ -d /var/lib/dcmtk/db ] || mkdir -p /var/lib/dcmtk/db
+chmod 755 /var/lib/dcmtk/db
+chown -h dcmtk:dcmtk /var/lib/dcmtk/db || true
+
+
+# Handle imagectn -> dcmqrdb transition in (3.5.3 -> 3.5.4)
+
+
+LASTVERSION=3.5.3-5
+
+case "$1" in
+configure)
+ if dpkg --compare-versions "$2" le "$LASTVERSION"; then
+
+ if [ -e "/etc/dcmtk/imagectn.cfg" ]; then
+ echo
+ echo "Configuration file /etc/dcmtk/imagectn.cfg has been modified by user."
+ echo "This file will be renamed to /etc/dcmtk/dcmqrscp.cfg."
+ echo "The package default version can be found in /etc/dcmtk/dcmqrscp.cfg.dpkg-new."
+ echo
+ mv -f /etc/dcmtk/dcmqrscp.cfg /etc/dcmtk/dcmqrscp.cfg.dpkg-new
+ mv -f /etc/dcmtk/imagectn.cfg /etc/dcmtk/dcmqrscp.cfg
+ fi
+
+ if [ -e "/etc/default/imagectn" ]; then
+ echo "Configuration file /etc/default/imagectn has been modified by user."
+ echo "This file will be converted to and replaced by /etc/default/dcmqrscp."
+ echo "The user's old version can be found in /etc/default/imagectn.dpkg-old."
+ echo "The package default version can be found in /etc/default/dcmqrscp.dpkg-new."
+ echo
+ mv -f /etc/default/imagectn /etc/default/imagectn.dpkg-old
+ mv -f /etc/default/dcmqrscp /etc/default/dcmqrscp.dpkg-new
+ sed -e 's/IMAGECTN_ENABLE/DCMQRSCP_ENABLE/g' -e 's/imagectn/dcmqrscp/g' \
+ </etc/default/imagectn.dpkg-old >/etc/default/dcmqrscp
+ fi
+
+ if [ -e "/etc/init.d/imagectn" ]; then
+ echo "Configuration file /etc/init.d/imagectn has been modified by user."
+ echo "This file will be replaced by /etc/init.d/dcmqrscp."
+ echo "The user's old version can be found in /etc/init.d/imagectn.dpkg-old"
+ echo
+ mv -f /etc/init.d/imagectn /etc/init.d/imagectn.dpkg-old
+ fi
+ # Remove (dangling) symlinks in /etc/rcN.d
+ update-rc.d imagectn remove >/dev/null
+ fi
+esac
+
+
+
+#DEBHELPER#
+
--- /dev/null
+#!/bin/sh
+
+set -e
+
+# Remove possible leftovers of imagectn -> dcmqrscp transition
+
+if [ "$1" = "purge" ] ; then
+
+ if [ -e /etc/default/imagectn.dpkg-old ]; then
+ rm -f /etc/default/imagectn.dpkg-old
+ fi
+
+ if [ -e /etc/init.d/imagectn.dpkg-old ]; then
+ rm -f /etc/init.d/imagectn.dpkg-old
+ fi
+
+ if [ -d /var/lib/dcmtk/db/STORESCP ]; then
+ rm -rf /var/lib/dcmtk/db/STORESCP
+ fi
+fi
+
+# Remove dcmtk user/group if they exist on cleanup
+if id -u "dcmtk" > /dev/null 2>&1; then
+ echo "Removing \`dcmtk' user and group from the system..."
+ userdel dcmtk
+fi
+
+#DEBHELPER#
+
--- /dev/null
+#!/bin/sh
+
+set -e
+
+# Prepare to handle imagectn -> dcmqrdb (3.5.3 -> 3.5.4) transition
+# without triggering a dpkg question
+# # Adapted from http://wiki.debian.org/DpkgConffileHandling
+
+PKGNAME=dcmtk
+
+# Remove a no-longer used conffile
+rm_conffile() {
+ CONFFILE="$1"
+ if [ -e "$CONFFILE" ]; then
+ md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+ old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
+ if [ "$md5sum" != "$old_md5sum" ]; then
+ echo "Obsolete conffile $CONFFILE has been modified by you."
+ echo "Saving as $CONFFILE.dpkg-bak ..."
+ mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+ else
+ echo "Removing obsolete conffile $CONFFILE ..."
+ rm -f "$CONFFILE"
+ fi
+ fi
+}
+
+LASTVERSION=3.5.3-5
+
+case "$1" in
+install|upgrade)
+ if dpkg --compare-versions "$2" le "$LASTVERSION"; then
+ rm_conffile "/etc/dcmtk/imagectn.cfg"
+ rm_conffile "/etc/default/imagectn"
+ rm_conffile "/etc/init.d/imagectn"
+ fi
+esac
+
+#DEBHELPER#
+
--- /dev/null
+#!/bin/sh
+set -e
+
+# This is in case we upgrade from dcmtk version < 3.5.4
+if [ -x "/etc/init.d/imagectn" ]; then
+ if which invoke-rc.d ; then
+ invoke-rc.d --quiet imagectn stop
+ else
+ /etc/init.d/imagectn stop
+ fi
+fi
+
+if [ -x "/etc/init.d/dcmqrscp" ]; then
+ if which invoke-rc.d ; then
+ invoke-rc.d --quiet dcmqrscp stop
+ else
+ /etc/init.d/dcmqrscp stop
+ fi
+fi
+
+#DEBHELPER#
+
+exit 0
--- /dev/null
+usr/include/dcmtk/*
+usr/lib/*/*.so
+usr/lib/*/cmake/
+usr/lib/*/pkgconfig
--- /dev/null
+usr/lib/*/*.so.*
--- /dev/null
+# There is more than one library in one package bundles which makes perfectly
+# sense in this application but does not enable naming the library package apropriately
+libdcmtk18: package-name-doesnt-match-sonames
+libdcmtk18: embedded-library
+libdcmtk18: no-symbols-control-file
--- /dev/null
+From dc6a2446dc03c9db90f82ce17a597f2cd53776c5 Mon Sep 17 00:00:00 2001
+From: Marco Eichelberg <dicom@offis.de>
+Date: Mon, 15 Apr 2024 12:12:51 +0200
+Subject: [PATCH] Fixed unchecked typecasts of DcmItem::search results.
+
+DcmItem::search() returns a stack of DcmObject pointers as search results.
+These pointers in most instances need to be casted to DcmItem, DcmElement
+or a subclass of these. In many cases, the type of the object was not
+properly checked before the typecast. This could lead to segmentation faults
+when invalid DICOM datasets were processed where elements had the wrong
+value representation.
+---
+ dcmdata/apps/cda2dcm.cc | 0
+ dcmdata/apps/stl2dcm.cc | 0
+ dcmdata/include/dcmtk/dcmdata/dcelem.h | 7 +++-
+ dcmdata/include/dcmtk/dcmdata/dcencdoc.h | 0
+ dcmdata/include/dcmtk/dcmdata/dcobject.h | 7 +++-
+ dcmdata/libsrc/dcddirif.cc | 4 +--
+ dcmdata/libsrc/dcdirrec.cc | 6 ++--
+ dcmdata/libsrc/dcfilefo.cc | 12 +++----
+ dcmdata/libsrc/dcitem.cc | 16 ++++-----
+ dcmimgle/libsrc/didocu.cc | 2 +-
+ dcmiod/libsrc/iodutil.cc | 4 +--
+ dcmjpeg/libsrc/djcodece.cc | 8 ++---
+ dcmnet/apps/storescu.cc | 8 ++++-
+ dcmnet/libsrc/dimcmd.cc | 38 ++++++++++++---------
+ dcmnet/libsrc/diutil.cc | 28 ++++++++--------
+ dcmnet/libsrc/dstorscu.cc | 2 +-
+ dcmpstat/apps/dcmmklut.cc | 6 ++--
+ dcmpstat/apps/dcmpschk.cc | 8 +++--
+ dcmpstat/libsrc/dviface.cc | 10 +++---
+ dcmpstat/libsrc/dvpsabl.cc | 4 +--
+ dcmpstat/libsrc/dvpscu.cc | 18 +++++-----
+ dcmpstat/libsrc/dvpsdal.cc | 4 +--
+ dcmpstat/libsrc/dvpsfs.cc | 22 ++++++-------
+ dcmpstat/libsrc/dvpsgal.cc | 4 +--
+ dcmpstat/libsrc/dvpsgll.cc | 4 +--
+ dcmpstat/libsrc/dvpsgrl.cc | 4 +--
+ dcmpstat/libsrc/dvpshlp.cc | 2 +-
+ dcmpstat/libsrc/dvpsib.cc | 42 ++++++++++++------------
+ dcmpstat/libsrc/dvpsibl.cc | 4 +--
+ dcmpstat/libsrc/dvpspll.cc | 4 +--
+ dcmpstat/libsrc/dvpsril.cc | 4 +--
+ dcmpstat/libsrc/dvpsrsl.cc | 4 +--
+ dcmpstat/libsrc/dvpssp.cc | 40 +++++++++++-----------
+ dcmpstat/libsrc/dvpstxl.cc | 4 +--
+ dcmpstat/libsrc/dvpsvll.cc | 4 +--
+ dcmrt/libsrc/drttypes.cc | 8 ++---
+ dcmsign/libsrc/dcsignat.cc | 22 ++++++-------
+ dcmsign/libsrc/sicert.cc | 4 +--
+ dcmsr/libsrc/dsrtypes.cc | 6 ++--
+ 39 files changed, 199 insertions(+), 175 deletions(-)
+ mode change 100755 => 100644 dcmdata/apps/cda2dcm.cc
+ mode change 100755 => 100644 dcmdata/apps/stl2dcm.cc
+ mode change 100755 => 100644 dcmdata/include/dcmtk/dcmdata/dcencdoc.h
+
+--- dcmtk.orig/dcmdata/include/dcmtk/dcmdata/dcelem.h
++++ dcmtk/dcmdata/include/dcmtk/dcmdata/dcelem.h
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2023, OFFIS e.V.
++ * Copyright (C) 1994-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -144,6 +144,11 @@
+ */
+ virtual OFBool isLeaf() const { return OFTrue; }
+
++ /** check if this element can be safely casted to DcmElement
++ * @return true if DcmElement, false otherwise
++ */
++ virtual OFBool isElement() const { return OFTrue; }
++
+ /** check if value of this element is loaded into main memory
+ * @return true if value is present in memory, false if value still resides in file
+ */
+--- dcmtk.orig/dcmdata/include/dcmtk/dcmdata/dcobject.h
++++ dcmtk/dcmdata/include/dcmtk/dcmdata/dcobject.h
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2020, OFFIS e.V.
++ * Copyright (C) 1994-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -308,6 +308,11 @@
+ */
+ virtual OFBool isLeaf() const = 0;
+
++ /** check if this element can be safely casted to DcmElement
++ * @return true if DcmElement, false otherwise
++ */
++ virtual OFBool isElement() const { return OFFalse; }
++
+ /** check if this element is nested in a sequence of items, i.e.\ not a
+ * top-level or stand-alone element
+ * @return true if this element is nested, false otherwise
+--- dcmtk.orig/dcmdata/libsrc/dcddirif.cc
++++ dcmtk/dcmdata/libsrc/dcddirif.cc
+@@ -433,7 +433,7 @@
+ OFBool first = OFTrue;
+ DcmStack stack1, stack2;
+ /* check whether attributes are equal */
+- while (item1->nextObject(stack1, first).good() && item2->nextObject(stack2, first).good())
++ while (item1->nextObject(stack1, first).good() && item2->nextObject(stack2, first).good() && stack1.top()->isElement() && stack2.top()->isElement())
+ {
+ if (!compareAttributes(OFstatic_cast(DcmElement *, stack1.top()), OFstatic_cast(DcmElement *, stack2.top()), fromSequence, i++, reason))
+ break;
+@@ -5586,7 +5586,7 @@
+ OFBool first = OFTrue;
+ DcmElement *delem = NULL;
+ /* iterate over all record elements */
+- while (record->nextObject(stack, first).good() && (result || !abortCheck))
++ while (record->nextObject(stack, first).good() && (result || !abortCheck) && stack.top()->isElement())
+ {
+ delem = OFstatic_cast(DcmElement *, stack.top());
+ if ((delem != NULL) && (delem->getLength() > 0))
+--- dcmtk.orig/dcmdata/libsrc/dcdirrec.cc
++++ dcmtk/dcmdata/libsrc/dcdirrec.cc
+@@ -1007,7 +1007,7 @@
+ DCMDATA_ERROR("Internal ERROR in DcmDirectoryRecord::fillElementsAndReadSOP()");
+ }
+ uiP = new DcmUniqueIdentifier(refSOPClassTag); // (0004,1510)
+- if (refFile->search(DCM_SOPClassUID, stack).good())
++ if (refFile->search(DCM_SOPClassUID, stack).good() && (stack.top()->ident() == EVR_UI))
+ {
+ char *uid = NULL;
+ OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
+@@ -1020,7 +1020,7 @@
+ insert(uiP, OFTrue);
+
+ uiP = new DcmUniqueIdentifier(refSOPInstTag); // (0004,1511)
+- if (refFile->search(DCM_SOPInstanceUID, stack).good() || refFile->search(DCM_MediaStorageSOPInstanceUID, stack).good())
++ if ((refFile->search(DCM_SOPInstanceUID, stack).good() || refFile->search(DCM_MediaStorageSOPInstanceUID, stack).good()) && (stack.top()->ident() == EVR_UI))
+ {
+ char *uid = NULL;
+ OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
+@@ -1033,7 +1033,7 @@
+ insert(uiP, OFTrue);
+
+ uiP = new DcmUniqueIdentifier(refFileXferTag); // (0004,1512)
+- if (refFile->search(DCM_TransferSyntaxUID, stack).good())
++ if (refFile->search(DCM_TransferSyntaxUID, stack).good() && (stack.top()->ident() == EVR_UI))
+ {
+ char *uid = NULL;
+ OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
+--- dcmtk.orig/dcmdata/libsrc/dcfilefo.cc
++++ dcmtk/dcmdata/libsrc/dcfilefo.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2022, OFFIS e.V.
++ * Copyright (C) 1994-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -362,7 +362,7 @@
+ {
+ if ((writeMode == EWM_updateMeta) || (elem->getLength() == 0))
+ {
+- if (dataset->search(DCM_SOPClassUID, stack).good())
++ if (dataset->search(DCM_SOPClassUID, stack).good() && (stack.top()->ident() == EVR_UI))
+ {
+ char *uid = NULL;
+ l_error = OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
+@@ -378,7 +378,7 @@
+ else if (DCM_dcmdataLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
+ {
+ // check whether UID in meta-header is identical to the one in the dataset
+- if (dataset->search(DCM_SOPClassUID, stack).good())
++ if (dataset->search(DCM_SOPClassUID, stack).good() && (stack.top()->ident() == EVR_UI))
+ {
+ OFString uidDataset, uidMetaHeader;
+ OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getOFStringArray(uidDataset);
+@@ -404,7 +404,7 @@
+ {
+ if ((writeMode == EWM_updateMeta) || (elem->getLength() == 0))
+ {
+- if (dataset->search(DCM_SOPInstanceUID, stack).good())
++ if (dataset->search(DCM_SOPInstanceUID, stack).good() && (stack.top()->ident() == EVR_UI))
+ {
+ char* uid = NULL;
+ l_error = OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getString(uid);
+@@ -422,7 +422,7 @@
+ else if (DCM_dcmdataLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
+ {
+ // check whether UID in meta-header is identical to the one in the dataset
+- if (dataset->search(DCM_SOPInstanceUID, stack).good())
++ if (dataset->search(DCM_SOPInstanceUID, stack).good() && (stack.top()->ident() == EVR_UI))
+ {
+ OFString uidDataset, uidMetaHeader;
+ OFstatic_cast(DcmUniqueIdentifier *, stack.top())->getOFStringArray(uidDataset);
+@@ -633,7 +633,7 @@
+ /* check whether meta header is present (and non-empty, i.e. contains elements) */
+ if (metainfo && !metainfo->isEmpty())
+ {
+- if (metainfo->search(DCM_TransferSyntaxUID, stack).good())
++ if (metainfo->search(DCM_TransferSyntaxUID, stack).good() && (stack.top()->ident() == EVR_UI))
+ {
+ DcmUniqueIdentifier *xferUI = OFstatic_cast(DcmUniqueIdentifier *, stack.top());
+ if (xferUI->getTag() == DCM_TransferSyntaxUID)
+--- dcmtk.orig/dcmdata/libsrc/dcitem.cc
++++ dcmtk/dcmdata/libsrc/dcitem.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2023, OFFIS e.V.
++ * Copyright (C) 1994-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -2332,7 +2332,7 @@
+ DcmStack stack;
+ OFBool result = OFFalse;
+
+- if (search(key, stack, ESM_fromHere, searchIntoSub).good())
++ if (search(key, stack, ESM_fromHere, searchIntoSub).good() && stack.top()->isElement())
+ {
+ DcmElement *elem = OFstatic_cast(DcmElement *, stack.top());
+ if (elem != NULL)
+@@ -2355,7 +2355,7 @@
+ DcmStack stack;
+ /* find the element */
+ OFCondition status = search(tagKey, stack, ESM_fromHere, searchIntoSub);
+- if (status.good())
++ if (status.good() && stack.top()->isElement())
+ {
+ element = OFstatic_cast(DcmElement *, stack.top());
+ /* should never happen but ... */
+@@ -2990,7 +2990,7 @@
+ DcmStack stack;
+ /* find the element */
+ OFCondition status = search(seqTagKey, stack, ESM_fromHere, searchIntoSub);
+- if (status.good())
++ if (status.good() && stack.top()->isElement())
+ {
+ DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
+ /* should never happen but ... */
+@@ -3027,7 +3027,7 @@
+ DcmStack stack;
+ /* find sequence */
+ OFCondition status = search(seqTagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (status.good())
++ if (status.good() && stack.top()->isElement())
+ {
+ /* get element */
+ DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
+@@ -3089,7 +3089,7 @@
+ OFCondition status = search(seqTag, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+ DcmSequenceOfItems *sequence = NULL;
+ /* sequence found? */
+- if (status.good())
++ if (status.good() && stack.top()->isElement())
+ {
+ /* get element */
+ DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
+@@ -3223,7 +3223,7 @@
+ DcmStack stack;
+ /* find sequence */
+ OFCondition status = search(seqTagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (status.good())
++ if (status.good() && stack.top()->isElement())
+ {
+ /* get element */
+ DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
+@@ -4224,7 +4224,7 @@
+ status = search(seqTag, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+ DcmSequenceOfItems *sequence = NULL;
+ /* sequence found? */
+- if (status.good())
++ if (status.good() && stack.top()->isElement())
+ {
+ /* get element */
+ DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
+--- dcmtk.orig/dcmimgle/libsrc/didocu.cc
++++ dcmtk/dcmimgle/libsrc/didocu.cc
+@@ -218,7 +218,7 @@
+ obj = Object;
+ // only search on main dataset level
+ if ((obj != NULL) && (obj->search(tag, stack, ESM_fromHere, OFFalse /* searchIntoSub */) == EC_Normal) &&
+- (stack.top()->getLength(Xfer) > 0))
++ (stack.top()->getLength(Xfer) > 0) && stack.top()->isElement())
+ {
+ return OFstatic_cast(DcmElement *, stack.top());
+ }
+--- dcmtk.orig/dcmiod/libsrc/iodutil.cc
++++ dcmtk/dcmiod/libsrc/iodutil.cc
+@@ -43,7 +43,7 @@
+ DcmStack stack;
+ const DcmTagKey tagKey = delem.getTag();
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good())
++ if (result.good() && stack.top()->isElement())
+ {
+ /* copy object from search stack */
+ result = delem.copyFrom(*stack.top());
+@@ -76,7 +76,7 @@
+
+ DcmStack stack;
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good())
++ if (result.good() && stack.top()->isElement())
+ {
+ /* copy object from search stack */
+ delem = OFstatic_cast(DcmElement*, stack.top()->clone());
+--- dcmtk.orig/dcmjpeg/libsrc/djcodece.cc
++++ dcmtk/dcmjpeg/libsrc/djcodece.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2001-2022, OFFIS e.V.
++ * Copyright (C) 2001-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -1399,17 +1399,17 @@
+ DcmElement *explanation = NULL;
+
+ DcmStack stack;
+- if ((dataset->search(DCM_WindowCenter, stack, ESM_fromHere, OFFalse)).good())
++ if ((dataset->search(DCM_WindowCenter, stack, ESM_fromHere, OFFalse)).good() && stack.top()->isElement())
+ {
+ center = OFreinterpret_cast(DcmElement*, stack.top());
+ }
+ stack.clear();
+- if ((dataset->search(DCM_WindowWidth, stack, ESM_fromHere, OFFalse)).good())
++ if ((dataset->search(DCM_WindowWidth, stack, ESM_fromHere, OFFalse)).good() && stack.top()->isElement())
+ {
+ width = OFreinterpret_cast(DcmElement*, stack.top());
+ }
+ stack.clear();
+- if ((dataset->search(DCM_WindowCenterWidthExplanation, stack, ESM_fromHere, OFFalse)).good())
++ if ((dataset->search(DCM_WindowCenterWidthExplanation, stack, ESM_fromHere, OFFalse)).good() && stack.top()->isElement())
+ {
+ explanation = OFreinterpret_cast(DcmElement*, stack.top());
+ }
+--- dcmtk.orig/dcmnet/apps/storescu.cc
++++ dcmtk/dcmnet/apps/storescu.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1996-2023, OFFIS e.V.
++ * Copyright (C) 1996-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -1138,6 +1138,12 @@
+ return OFFalse;
+ }
+
++ if (! stack.top()->isElement())
++ {
++ OFLOG_ERROR(storescuLogger, "updateStringAttributeValue: not a DcmElement: " << tag.getTagName() << " " << key);
++ return OFFalse;
++ }
++
+ DcmElement *elem = OFstatic_cast(DcmElement *, stack.top());
+
+ DcmVR vr(elem->ident());
+--- dcmtk.orig/dcmnet/libsrc/dimcmd.cc
++++ dcmtk/dcmnet/libsrc/dimcmd.cc
+@@ -191,14 +191,16 @@
+ static OFCondition
+ getString(DcmDataset *obj, DcmTagKey t, char *s, int maxlen, OFBool *spacePadded)
+ {
+- DcmElement *elem;
++ DcmElement *elem = NULL;
+ DcmStack stack;
+ OFCondition ec = EC_Normal;
+ char* aString;
+
+ ec = obj->search(t, stack);
+- elem = (DcmElement*)stack.top();
+- if (ec == EC_Normal && elem != NULL) {
++ if (ec.good() && stack.top()->isElement())
++ elem = (DcmElement*)stack.top();
++
++ if (elem != NULL) {
+ if (elem->getLength() == 0) {
+ s[0] = '\0';
+ } else if (elem->getLength() > (Uint32)maxlen) {
+@@ -263,17 +265,19 @@
+ static OFCondition
+ getUS(DcmDataset *obj, DcmTagKey t, Uint16 *us)
+ {
+- DcmElement *elem;
++ DcmElement *elem = NULL;
+ DcmStack stack;
+ OFCondition ec = EC_Normal;
+
+ ec = obj->search(t, stack);
+- elem = (DcmElement*)stack.top();
+- if (ec == EC_Normal && elem != NULL) {
++ if (ec.good() && stack.top()->isElement())
++ elem = (DcmElement*)stack.top();
++
++ if (elem != NULL) {
+ ec = elem->getUint16(*us, 0);
+ }
+
+- return (ec == EC_Normal)?(EC_Normal):(DIMSE_PARSEFAILED);
++ return (ec.good())?(EC_Normal):(DIMSE_PARSEFAILED);
+ }
+
+ static OFCondition
+@@ -314,17 +318,19 @@
+ static OFCondition
+ getUL(DcmDataset *obj, DcmTagKey t, Uint32 *ul)
+ {
+- DcmElement *elem;
++ DcmElement *elem = NULL;
+ DcmStack stack;
+ OFCondition ec = EC_Normal;
+
+ ec = obj->search(t, stack);
+- elem = (DcmElement*)stack.top();
+- if (ec == EC_Normal && elem != NULL) {
++ if (ec.good() && stack.top()->isElement())
++ elem = (DcmElement*)stack.top();
++
++ if (elem != NULL) {
+ ec = elem->getUint32(*ul, 0);
+ }
+
+- return (ec == EC_Normal)?(EC_Normal):(DIMSE_PARSEFAILED);
++ return (ec.good())?(EC_Normal):(DIMSE_PARSEFAILED);
+ }
+
+ #if 0
+@@ -375,15 +381,17 @@
+ static OFCondition
+ getAttributeList(DcmDataset *obj, DcmTagKey t, Uint16 **lst, int *listCount)
+ {
+- DcmElement *elem;
++ DcmElement *elem = NULL;
+ DcmStack stack;
+ OFCondition ec = EC_Normal;
+ Uint16 *aList = NULL;
+ Uint32 nBytes = 0;
+
+ ec = obj->search(t, stack);
+- elem = (DcmElement*)stack.top();
+- if (ec == EC_Normal && elem != NULL) {
++ if (ec.good() && stack.top()->isElement())
++ elem = (DcmElement*)stack.top();
++
++ if (elem) {
+ nBytes = elem->getLength();
+ *listCount = (int)(nBytes / sizeof(Uint16));
+ if (*listCount > 0) {
+@@ -395,7 +403,7 @@
+ }
+ }
+
+- return (ec == EC_Normal)?(EC_Normal):(DIMSE_PARSEFAILED);
++ return (ec.good())?(EC_Normal):(DIMSE_PARSEFAILED);
+ }
+
+ /*
+--- dcmtk.orig/dcmnet/libsrc/diutil.cc
++++ dcmtk/dcmnet/libsrc/diutil.cc
+@@ -159,23 +159,21 @@
+ OFBool
+ DU_getStringDOElement(DcmItem *obj, DcmTagKey t, char *s, size_t bufsize)
+ {
+- DcmByteString *elem;
+ DcmStack stack;
+- OFCondition ec = EC_Normal;
+ char* aString;
+
+- ec = obj->search(t, stack);
+- elem = (DcmByteString*) stack.top();
+- if (ec == EC_Normal && elem != NULL) {
++ OFCondition ec = obj->search(t, stack);
++ if (ec.good() && (stack.top() != NULL) && stack.top()->isElement()) {
++ DcmElement *elem = (DcmElement *) stack.top();
+ if (elem->getLength() == 0) {
+ s[0] = '\0';
+ } else {
+ ec = elem->getString(aString);
+- if (ec == EC_Normal)
++ if (ec.good())
+ OFStandard::strlcpy(s, aString, bufsize);
+ }
+ }
+- return (ec == EC_Normal);
++ return (ec.good());
+ }
+
+ OFBool
+@@ -193,7 +191,7 @@
+ ec = obj->insert(e, OFTrue);
+ }
+
+- return (ec == EC_Normal);
++ return (ec.good());
+ }
+
+ OFBool
+@@ -201,15 +199,15 @@
+ {
+ DcmElement *elem;
+ DcmStack stack;
+- OFCondition ec = EC_Normal;
+
+- ec = obj->search(t, stack);
+- elem = (DcmElement*) stack.top();
+- if (ec == EC_Normal && elem != NULL) {
+- ec = elem->getUint16(*us, 0);
++ OFCondition ec = obj->search(t, stack);
++ if (ec.good() && stack.top()->isElement())
++ {
++ elem = (DcmElement*) stack.top();
++ if (elem) ec = elem->getUint16(*us, 0);
+ }
+
+- return (ec == EC_Normal);
++ return (ec.good());
+ }
+
+ OFBool
+@@ -226,7 +224,7 @@
+ if (ec == EC_Normal) {
+ ec = obj->insert(e, OFTrue);
+ }
+- return (ec == EC_Normal);
++ return (ec.good());
+ }
+
+ OFBool
+--- dcmtk.orig/dcmnet/libsrc/dstorscu.cc
++++ dcmtk/dcmnet/libsrc/dstorscu.cc
+@@ -484,7 +484,7 @@
+ OFFilename dirName;
+ OFStandard::getDirNameFromPath(dirName, filename, OFFalse /* assumeDirName */);
+ // iterate over all items (directory records) where ReferencedFileID is present
+- while (dataset->search(DCM_ReferencedFileID, stack, ESM_afterStackTop, OFTrue).good())
++ while (dataset->search(DCM_ReferencedFileID, stack, ESM_afterStackTop, OFTrue).good() && stack.top()->isElement())
+ {
+ // make sure that the dataset and element pointer are there
+ if (stack.card() > 1)
+--- dcmtk.orig/dcmpstat/apps/dcmmklut.cc
++++ dcmtk/dcmpstat/apps/dcmmklut.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2023, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -971,7 +971,7 @@
+ {
+ // search existing sequence
+ DcmStack stack;
+- if (EC_Normal == dataset->search(DCM_PresentationLUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dataset->search(DCM_PresentationLUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ dseq=(DcmSequenceOfItems *)stack.top();
+ }
+ if (dseq == NULL)
+@@ -992,7 +992,7 @@
+ {
+ // search existing sequence
+ DcmStack stack;
+- if (EC_Normal == dataset->search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dataset->search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ dseq=(DcmSequenceOfItems *)stack.top();
+ }
+ if (dseq == NULL)
+--- dcmtk.orig/dcmpstat/apps/dcmpschk.cc
++++ dcmtk/dcmpstat/apps/dcmpschk.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2000-2023, OFFIS e.V.
++ * Copyright (C) 2000-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -652,7 +652,11 @@
+ OFOStringStream str;
+
+ ec = dset->search(key, stack, ESM_fromHere, OFFalse);
+- elem = (DcmElement*) stack.top();
++ if (ec.good() && stack.top()->isElement())
++ {
++ elem = (DcmElement*) stack.top();
++ }
++
+ if (elem)
+ elem->print(str, DCMTypes::PF_shortenLongTagValues);
+ else
+--- dcmtk.orig/dcmpstat/libsrc/dviface.cc
++++ dcmtk/dcmpstat/libsrc/dviface.cc
+@@ -1425,14 +1425,14 @@
+ if (reference != NULL)
+ {
+ DcmStack stack;
+- if (dataset->search(DCM_ContentDescription, stack, ESM_fromHere, OFFalse) == EC_Normal)
++ if (dataset->search(DCM_ContentDescription, stack, ESM_fromHere, OFFalse) == EC_Normal && (stack.top()->ident() == EVR_LO))
+ {
+ char *value = NULL;
+ if ((*OFstatic_cast(DcmLongString *, stack.top())).getString(value) == EC_Normal)
+ reference->Description = value;
+ }
+ stack.clear();
+- if (dataset->search(DCM_ContentLabel, stack, ESM_fromHere, OFFalse) == EC_Normal)
++ if (dataset->search(DCM_ContentLabel, stack, ESM_fromHere, OFFalse) == EC_Normal && (stack.top()->ident() == EVR_LO))
+ {
+ char *value = NULL;
+ if ((*OFstatic_cast(DcmLongString *, stack.top())).getString(value) == EC_Normal)
+@@ -2843,12 +2843,12 @@
+ DcmDataset *dset = fileformat.getDataset();
+ if (dset)
+ {
+- if (EC_Normal == dset->search(DCM_SOPInstanceUID, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset->search(DCM_SOPInstanceUID, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ OFstatic_cast(DcmElement *, stack.top())->getString(instanceUID);
+ }
+ stack.clear();
+- if (EC_Normal == dset->search(DCM_SOPClassUID, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset->search(DCM_SOPClassUID, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ OFstatic_cast(DcmElement *, stack.top())->getString(classUID);
+ }
+@@ -3764,7 +3764,7 @@
+ DVPSPresentationLUT presentationLUT;
+ if (EC_Normal != presentationLUT.read(*dataset, OFFalse)) presentationLUT.setType(DVPSP_identity);
+ result = dataset->search(sopclassuid.getTag(), stack, ESM_fromHere, OFFalse);
+- if (EC_Normal == result)
++ if (EC_Normal == result && (stack.top()->ident() == EVR_UI))
+ {
+ char *sopclass = NULL;
+ sopclassuid = *OFstatic_cast(DcmUniqueIdentifier *, stack.top());
+--- dcmtk.orig/dcmpstat/libsrc/dvpsabl.cc
++++ dcmtk/dcmpstat/libsrc/dvpsabl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1999-2010, OFFIS e.V.
++ * Copyright (C) 1999-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -69,7 +69,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_RETIRED_AnnotationContentSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_RETIRED_AnnotationContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpscu.cc
++++ dcmtk/dcmpstat/libsrc/dvpscu.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2020, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -80,14 +80,14 @@
+
+ /* first we look for the Curve Data */
+ DcmTagKey key(0x5000 + group,0x3000);
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_curveData = (DcmElement *)(stack.top());
+ } else return EC_IllegalCall;
+
+ key.setElement(0x0005); // Curve Dimensions
+ stack.clear();
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_curveDimensions = (DcmElement *)(stack.top());
+ } else return EC_IllegalCall;
+@@ -101,42 +101,42 @@
+
+ key.setElement(0x0010); // Number of Points
+ stack.clear();
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_numberOfPoints = (DcmElement *)(stack.top());
+ } else return EC_IllegalCall;
+
+ key.setElement(0x0020); // Type of Data
+ stack.clear();
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_typeOfData = (DcmElement *)(stack.top());
+ } else return EC_IllegalCall;
+
+ key.setElement(0x0103); // Data Value Representation
+ stack.clear();
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_dataVR = (DcmElement *)(stack.top());
+ } else return EC_IllegalCall;
+
+ key.setElement(0x0022); // Curve Description
+ stack.clear();
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_curveDescription = (DcmElement *)(stack.top());
+ }
+
+ key.setElement(0x0030); // Axis Units
+ stack.clear();
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_axisUnits = (DcmElement *)(stack.top());
+ }
+
+ key.setElement(0x2500); // Curve Label
+ stack.clear();
+- if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && stack.top()->isElement())
+ {
+ d_curveLabel = (DcmElement *)(stack.top());
+ }
+--- dcmtk.orig/dcmpstat/libsrc/dvpsdal.cc
++++ dcmtk/dcmpstat/libsrc/dvpsdal.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1999-2010, OFFIS e.V.
++ * Copyright (C) 1999-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -67,7 +67,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_DisplayedAreaSelectionSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_DisplayedAreaSelectionSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsfs.cc
++++ dcmtk/dcmpstat/libsrc/dvpsfs.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2021, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -280,7 +280,7 @@
+ {
+ stack.clear();
+
+- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
+ {
+ DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+@@ -480,7 +480,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)numberOfCopies.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)numberOfCopies.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_IS))
+ {
+ numberOfCopies = *((DcmIntegerString *)(stack.top()));
+ Sint32 numCopies=0;
+@@ -502,7 +502,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)printPriority.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)printPriority.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ printPriority = *((DcmCodeString *)(stack.top()));
+ OFString aString;
+@@ -523,7 +523,7 @@
+ {
+ Uint32 numMediumTypes = cfg.getTargetPrinterNumberOfMediumTypes(cfgname);
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)mediumType.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)mediumType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ mediumType = *((DcmCodeString *)(stack.top()));
+ OFString theMedium;
+@@ -555,7 +555,7 @@
+ {
+ Uint32 numFilmDestination = cfg.getTargetPrinterNumberOfFilmDestinations(cfgname);
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmDestination.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmDestination.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ filmDestination = *((DcmCodeString *)(stack.top()));
+ OFString theDestination;
+@@ -586,7 +586,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmSessionLabel.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)filmSessionLabel.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_LO))
+ {
+ filmSessionLabel = *((DcmLongString *)(stack.top()));
+ ADD_TO_PDATASET(DcmLongString, filmSessionLabel)
+@@ -597,7 +597,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)ownerID.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)ownerID.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SH))
+ {
+ ownerID = *((DcmShortString *)(stack.top()));
+ ADD_TO_PDATASET(DcmShortString, ownerID)
+@@ -611,7 +611,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ illumination = *((DcmUnsignedShort *)(stack.top()));
+ // we don't check illumination set by the user (for now)
+@@ -623,7 +623,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ reflectedAmbientLight = *((DcmUnsignedShort *)(stack.top()));
+ // we don't check reflected ambient light set by the user (for now)
+@@ -636,7 +636,7 @@
+ {
+ stack.clear();
+
+- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
+ {
+ DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsgal.cc
++++ dcmtk/dcmpstat/libsrc/dvpsgal.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2010, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -69,7 +69,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_GraphicAnnotationSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_GraphicAnnotationSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsgll.cc
++++ dcmtk/dcmpstat/libsrc/dvpsgll.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2017, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -75,7 +75,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_GraphicLayerSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_GraphicLayerSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsgrl.cc
++++ dcmtk/dcmpstat/libsrc/dvpsgrl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2010, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -66,7 +66,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_GraphicObjectSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_GraphicObjectSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpshlp.cc
++++ dcmtk/dcmpstat/libsrc/dvpshlp.cc
+@@ -178,7 +178,7 @@
+ {
+ item = seq.getItem(i);
+ stack.clear();
+- if (EC_Normal == item->search(DCM_ReferencedSOPClassUID, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == item->search(DCM_ReferencedSOPClassUID, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_UI))
+ {
+ aString.clear();
+ refuid = (DcmUniqueIdentifier *)(stack.top());
+--- dcmtk.orig/dcmpstat/libsrc/dvpsib.cc
++++ dcmtk/dcmpstat/libsrc/dvpsib.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2018, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -153,7 +153,7 @@
+ if (result==EC_Normal)
+ {
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+@@ -181,7 +181,7 @@
+ // check referenced presentation LUT sequence
+ // if there is any reference, it must refer to one of the presentation LUTs we are managing.
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+@@ -672,7 +672,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)imageBoxPosition.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)imageBoxPosition.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ imageBoxPosition = *((DcmUnsignedShort *)(stack.top()));
+ // the image box position is checked elsewhere
+@@ -688,7 +688,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ magnificationType = *((DcmCodeString *)(stack.top()));
+ Uint32 numMagnifications = cfg.getTargetPrinterNumberOfMagnificationTypes(cfgname);
+@@ -721,7 +721,7 @@
+ {
+
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ smoothingType = *((DcmCodeString *)(stack.top()));
+ Uint32 numSmoothings = cfg.getTargetPrinterNumberOfSmoothingTypes(cfgname);
+@@ -761,7 +761,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_ST))
+ {
+ configurationInformation = *((DcmShortText *)(stack.top()));
+ Uint32 numConfigurationInformation = cfg.getTargetPrinterNumberOfConfigurationSettings(cfgname);
+@@ -800,7 +800,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)polarity.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)polarity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ polarity = *((DcmCodeString *)(stack.top()));
+ OFString thePolarity;
+@@ -820,7 +820,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedImageSize.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedImageSize.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_DS))
+ {
+ if (! cfg.getTargetPrinterSupportsRequestedImageSize(cfgname))
+ {
+@@ -841,7 +841,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedDecimateCropBehavior.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)requestedDecimateCropBehavior.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ if (! cfg.getTargetPrinterSupportsDecimateCrop(cfgname))
+ {
+@@ -871,7 +871,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search(DCM_BasicGrayscaleImageSequence, stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search(DCM_BasicGrayscaleImageSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
+ {
+ DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+@@ -971,7 +971,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)samplesPerPixel.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)samplesPerPixel.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ samplesPerPixel = *((DcmUnsignedShort *)(stack.top()));
+ val = 0;
+@@ -994,7 +994,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)rows.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)rows.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ rows = *((DcmUnsignedShort *)(stack.top()));
+ val = 0;
+@@ -1017,7 +1017,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)columns.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)columns.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ columns = *((DcmUnsignedShort *)(stack.top()));
+ val = 0;
+@@ -1042,7 +1042,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsStored.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsStored.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ bitsStored = *((DcmUnsignedShort *)(stack.top()));
+ val = 0;
+@@ -1082,7 +1082,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsAllocated.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)bitsAllocated.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ bitsAllocated = *((DcmUnsignedShort *)(stack.top()));
+ val = 0;
+@@ -1105,7 +1105,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)highBit.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)highBit.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ highBit = *((DcmUnsignedShort *)(stack.top()));
+ val = 0;
+@@ -1128,7 +1128,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelRepresentation.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelRepresentation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ pixelRepresentation = *((DcmUnsignedShort *)(stack.top()));
+ val = 0;
+@@ -1151,7 +1151,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)photometricInterpretation.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)photometricInterpretation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ photometricInterpretation = *((DcmCodeString *)(stack.top()));
+ OFString theColorModel;
+@@ -1175,7 +1175,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelAspectRatio.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)pixelAspectRatio.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_IS))
+ {
+ pixelAspectRatio = *((DcmIntegerString *)(stack.top()));
+ if (pixelAspectRatio.getVM() != 2)
+@@ -1193,7 +1193,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search(DCM_PixelData, stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search(DCM_PixelData, stack, ESM_fromHere, OFFalse)) && stack.top()->isElement())
+ {
+ pixelData = new DcmPixelData(DCM_PixelData);
+ if (pixelData)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsibl.cc
++++ dcmtk/dcmpstat/libsrc/dvpsibl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1999-2010, OFFIS e.V.
++ * Copyright (C) 1999-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -68,7 +68,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_RETIRED_ImageBoxContentSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_RETIRED_ImageBoxContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpspll.cc
++++ dcmtk/dcmpstat/libsrc/dvpspll.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1999-2022, OFFIS e.V.
++ * Copyright (C) 1999-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -72,7 +72,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_RETIRED_PresentationLUTContentSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_RETIRED_PresentationLUTContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsril.cc
++++ dcmtk/dcmpstat/libsrc/dvpsril.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2022, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -71,7 +71,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_ReferencedImageSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsrsl.cc
++++ dcmtk/dcmpstat/libsrc/dvpsrsl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2010, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -69,7 +69,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_ReferencedSeriesSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_ReferencedSeriesSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpssp.cc
++++ dcmtk/dcmpstat/libsrc/dvpssp.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2021, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -328,7 +328,7 @@
+ if (result==EC_Normal)
+ {
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_RETIRED_FilmBoxContentSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_RETIRED_FilmBoxContentSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+@@ -362,7 +362,7 @@
+ // check referenced presentation LUT sequence
+ // if there is any reference, it must refer to one of the presentation LUTs we are managing.
+ stack.clear();
+- if (EC_Normal == item->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == item->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+@@ -445,7 +445,7 @@
+ if (result==EC_Normal)
+ {
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_RETIRED_PrintManagementCapabilitiesSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_RETIRED_PrintManagementCapabilitiesSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ OFBool haveFilmBox = OFFalse;
+ OFBool haveGrayscaleImageBox = OFFalse;
+@@ -511,7 +511,7 @@
+ destination.clear();
+ printerName.clear();
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_RETIRED_PrinterCharacteristicsSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_RETIRED_PrinterCharacteristicsSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq = (DcmSequenceOfItems *)stack.top();
+ if (seq->card() > 0)
+@@ -1536,7 +1536,7 @@
+ {
+ // N-CREATE was successful, now evaluate Referenced Image Box SQ
+ stack.clear();
+- if (EC_Normal == attributeListOut->search(DCM_ReferencedImageBoxSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == attributeListOut->search(DCM_ReferencedImageBoxSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ numItems = (size_t)seq->card();
+@@ -1559,7 +1559,7 @@
+ // evaluate Referenced Basic Annotation Box SQ if present
+ stack.clear();
+ annotationContentList.clearAnnotationSOPInstanceUIDs();
+- if (EC_Normal == attributeListOut->search(DCM_ReferencedBasicAnnotationBoxSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == attributeListOut->search(DCM_ReferencedBasicAnnotationBoxSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ numItems = (size_t)seq->card();
+@@ -2419,7 +2419,7 @@
+ {
+ stack.clear();
+
+- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
+ {
+ DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+@@ -2487,7 +2487,7 @@
+ {
+ stack.clear();
+
+- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedFilmSessionSequence, stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedFilmSessionSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
+ {
+ DcmUniqueIdentifier classUID(DCM_ReferencedSOPClassUID);
+ DcmUniqueIdentifier instanceUID(DCM_ReferencedSOPInstanceUID);
+@@ -2706,7 +2706,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)magnificationType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ magnificationType = *((DcmCodeString *)(stack.top()));
+ Uint32 numMagnifications = cfg.getTargetPrinterNumberOfMagnificationTypes(cfgname);
+@@ -2739,7 +2739,7 @@
+ {
+
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)smoothingType.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ smoothingType = *((DcmCodeString *)(stack.top()));
+ Uint32 numSmoothings = cfg.getTargetPrinterNumberOfSmoothingTypes(cfgname);
+@@ -2781,7 +2781,7 @@
+ {
+
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)borderDensity.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)borderDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ borderDensity = *((DcmCodeString *)(stack.top()));
+ Uint32 numBorderDensities = cfg.getTargetPrinterNumberOfBorderDensities(cfgname);
+@@ -2832,7 +2832,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)emptyImageDensity.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)emptyImageDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ emptyImageDensity = *((DcmCodeString *)(stack.top()));
+ Uint32 numEmptyImageDensities = cfg.getTargetPrinterNumberOfEmptyImageDensities(cfgname);
+@@ -2883,7 +2883,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)maxDensity.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)maxDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ maxDensity = *((DcmUnsignedShort *)(stack.top()));
+ // we don't check a max density set by the user (for now)
+@@ -2895,7 +2895,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)minDensity.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)minDensity.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ minDensity = *((DcmUnsignedShort *)(stack.top()));
+ Uint32 numMinDensities = cfg.getTargetPrinterNumberOfMinDensities(cfgname);
+@@ -2917,7 +2917,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)trim.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)trim.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_CS))
+ {
+ trim = *((DcmCodeString *)(stack.top()));
+
+@@ -2945,7 +2945,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)configurationInformation.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_ST))
+ {
+ configurationInformation = *((DcmShortText *)(stack.top()));
+ Uint32 numConfigurationInformation = cfg.getTargetPrinterNumberOfConfigurationSettings(cfgname);
+@@ -2987,7 +2987,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)illumination.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ illumination = *((DcmUnsignedShort *)(stack.top()));
+ // we don't check illumination set by the user (for now)
+@@ -2999,7 +2999,7 @@
+ if (result)
+ {
+ stack.clear();
+- if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search((DcmTagKey &)reflectedAmbientLight.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
+ {
+ reflectedAmbientLight = *((DcmUnsignedShort *)(stack.top()));
+ // we don't check reflected ambient light set by the user (for now)
+@@ -3012,7 +3012,7 @@
+ {
+ stack.clear();
+
+- if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)))
++ if (rqDataset && (EC_Normal == rqDataset->search(DCM_ReferencedPresentationLUTSequence, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_SQ))
+ {
+ DcmSequenceOfItems *seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+--- dcmtk.orig/dcmpstat/libsrc/dvpstxl.cc
++++ dcmtk/dcmpstat/libsrc/dvpstxl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2010, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -66,7 +66,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_TextObjectSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_TextObjectSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmpstat/libsrc/dvpsvll.cc
++++ dcmtk/dcmpstat/libsrc/dvpsvll.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2010, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -66,7 +66,7 @@
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+--- dcmtk.orig/dcmrt/libsrc/drttypes.cc
++++ dcmtk/dcmrt/libsrc/drttypes.cc
+@@ -1,14 +1,12 @@
+ /*
+ *
+- * Copyright (c) 2008-2021, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
+- * Copyright (C) 2013-2021, J. Riesmeier, Oldenburg, Germany
++ * Copyright (c) 2008-2024, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
++ * Copyright (C) 2013-2024, J. Riesmeier, Oldenburg, Germany
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * Source file for class DRTTypes
+ *
+ * Generated manually based on dsrtypes.cc
+- * File created on 2008-12-05
+- * Last modified on 2016-02-12 by Riesmeier
+ *
+ */
+
+@@ -212,7 +210,7 @@
+ {
+ DcmStack stack;
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good())
++ if (result.good() && stack.top()->isElement())
+ {
+ DcmElement *element = OFstatic_cast(DcmElement *, stack.top());
+ if (element != NULL)
+--- dcmtk.orig/dcmsign/libsrc/dcsignat.cc
++++ dcmtk/dcmsign/libsrc/dcsignat.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2000-2023, OFFIS e.V.
++ * Copyright (C) 2000-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -104,7 +104,7 @@
+ macid = 0xFFFF;
+ DcmStack stack;
+ OFCondition result = item.search(DCM_MACIDNumber, stack, ESM_fromHere, OFFalse);
+- if (result.good() && (stack.top()->isLeaf()))
++ if (result.good() && (stack.top()->isElement()))
+ {
+ result = ((DcmElement *)(stack.top()))->getUint16(macid);
+ }
+@@ -734,7 +734,7 @@
+ // read MAC Calculation Transfer Syntax UID
+ if (result.good())
+ {
+- if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ char *uid = NULL;
+ if ((((DcmElement *)(stack.top()))->getString(uid)).good())
+@@ -750,7 +750,7 @@
+ if (result.good())
+ {
+ stack.clear();
+- if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ OFString macidentifier;
+ if ((((DcmElement *)(stack.top()))->getOFString(macidentifier, 0)).good())
+@@ -783,7 +783,7 @@
+ if (result.good())
+ {
+ stack.clear();
+- if ((selectedSignatureItem->search(DCM_Signature, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedSignatureItem->search(DCM_Signature, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->ident() == EVR_OB))
+ {
+ signature = new DcmOtherByteOtherWord(*((DcmOtherByteOtherWord *)(stack.top())));
+ if (signature == NULL) result = EC_MemoryExhausted;
+@@ -960,7 +960,7 @@
+ DcmStack stack;
+
+ // read MAC Calculation Transfer Syntax UID
+- if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ char *uid = NULL;
+ if ((((DcmElement *)(stack.top()))->getString(uid)).good() && uid)
+@@ -1005,7 +1005,7 @@
+ DcmStack stack;
+
+ // read MAC Algorithm
+- if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
+ }
+@@ -1020,7 +1020,7 @@
+ DcmStack stack;
+
+ // read signature UID
+- if ((selectedSignatureItem->search(DCM_DigitalSignatureUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedSignatureItem->search(DCM_DigitalSignatureUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
+ }
+@@ -1048,7 +1048,7 @@
+ DcmStack stack;
+
+ // read signature date/time
+- if ((selectedSignatureItem->search(DCM_DigitalSignatureDateTime, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedSignatureItem->search(DCM_DigitalSignatureDateTime, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
+ }
+@@ -1119,7 +1119,7 @@
+ // check MAC Calculation Transfer Syntax UID
+ if (result.good())
+ {
+- if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ char *uid = NULL;
+ if ((((DcmElement *)(stack.top()))->getString(uid)).good())
+@@ -1142,7 +1142,7 @@
+ {
+ E_MACType mac = EMT_RIPEMD160;
+ stack.clear();
+- if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isLeaf()))
++ if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (stack.top()->isElement()))
+ {
+ OFString macidentifier;
+ if ((((DcmElement *)(stack.top()))->getOFString(macidentifier, 0)).good())
+--- dcmtk.orig/dcmsign/libsrc/sicert.cc
++++ dcmtk/dcmsign/libsrc/sicert.cc
+@@ -147,7 +147,7 @@
+ OFString aString;
+ DcmStack stack;
+ result = item.search(DCM_CertificateType, stack, ESM_fromHere, OFFalse);
+- if (result.good())
++ if (result.good() && stack.top()->isElement())
+ {
+ result = ((DcmElement *)(stack.top()))->getOFString(aString, 0);
+ if (result.good())
+@@ -156,7 +156,7 @@
+ {
+ stack.clear();
+ result = item.search(DCM_CertificateOfSigner, stack, ESM_fromHere, OFFalse);
+- if (result.good())
++ if (result.good() && stack.top()->isElement())
+ {
+ DcmElement *cert = (DcmElement *)stack.top();
+ Uint8 *data = NULL;
+--- dcmtk.orig/dcmsr/libsrc/dsrtypes.cc
++++ dcmtk/dcmsr/libsrc/dsrtypes.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2000-2023, OFFIS e.V.
++ * Copyright (C) 2000-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -1178,7 +1178,7 @@
+ DcmStack stack;
+ const DcmTagKey tagKey = delem.getTag();
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good())
++ if (result.good() && stack.top()->isElement())
+ {
+ /* copy object from search stack */
+ result = delem.copyFrom(*stack.top());
+@@ -1203,7 +1203,7 @@
+ {
+ DcmStack stack;
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good())
++ if (result.good() && stack.top()->isElement())
+ {
+ DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
+ /* we need a reference to the original element in order to determine the SpecificCharacterSet */
--- /dev/null
+From 601b227eecaab33a3a3a11dc256d84b1a62f63af Mon Sep 17 00:00:00 2001
+From: Marco Eichelberg <dicom@offis.de>
+Date: Mon, 15 Apr 2024 12:19:33 +0200
+Subject: [PATCH] Fixed unchecked typecasts and fixed LUT handling.
+
+This commit adds further fixes for unchecked typecasts of DcmItem::search()
+results (see description of previous commit). Furthermore, this commit
+specifically addresses the handling of look-up tables (LUTs) in module
+dcmpstat, where attribute (0028,3006) LUTData may use either US or OW
+value representation, and (0028,3002) LUTDescriptor may be either US or SS.
+The code should now properly handle all permitted value representations.
+LUTData is now always written as OW in order to avoid the 64k size limit
+for US in explicit VR encoding.
+
+Thanks to Martin Zeiser from the Cisco Talos team
+<vulndiscovery@external.cisco.com> for the bug report (TALOS-2024-1957).
+
+Together with the previous commit, this closes DCMTK issue #1120.
+---
+ dcmpstat/libsrc/dcmpstat.cc | 40 ++++++++++++++++-------
+ dcmpstat/libsrc/dvpspl.cc | 34 +++++++++++++------
+ dcmpstat/libsrc/dvpssv.cc | 34 +++++++++++++------
+ dcmpstat/libsrc/dvpssvl.cc | 25 +++++++++-----
+ dcmpstat/libsrc/dvpstat.cc | 65 +++++++++++++++++--------------------
+ dcmpstat/libsrc/dvpsvl.cc | 19 +++++++++--
+ 6 files changed, 139 insertions(+), 78 deletions(-)
+
+diff --git a/dcmpstat/libsrc/dcmpstat.cc b/dcmpstat/libsrc/dcmpstat.cc
+index 4a8e5af6c3..a7d11abaca 100644
+--- a/dcmpstat/libsrc/dcmpstat.cc
++++ b/dcmpstat/libsrc/dcmpstat.cc
+@@ -384,12 +384,16 @@ OFCondition DcmPresentationState::read(DcmItem &dset)
+ {
+ item = seq->getItem(0);
+ stack.clear();
+- // LUTDescriptor can be US or SS. For now we only handle US.
++
++ // LUTDescriptor can be US or SS
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTDescriptor.getTag(),
+- stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_SS))
+ {
+- modalityLUTDescriptor = *((DcmUnsignedShort *)(stack.top()));
++ // We explicitly use DcmElement::operator=(), which works for US and SS
++ DcmElement *mLUTDescriptor = &modalityLUTDescriptor;
++ mLUTDescriptor->operator=(* OFstatic_cast(DcmElement *, stack.top()));
+ }
++
+ stack.clear();
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTExplanation.getTag(),
+ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_LO))
+@@ -400,9 +404,11 @@ OFCondition DcmPresentationState::read(DcmItem &dset)
+
+ // LUTData can be OW, US or SS. For now we only handle US.
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTData.getTag(),
+- stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_OW))
+ {
+- modalityLUTData = *((DcmUnsignedShort *)(stack.top()));
++ // we deliberately call DcmElement::operator=() here, which will work for both DcmUnsignedShort and DcmOtherByteOtherWord parameters
++ DcmElement *mdata = &modalityLUTData;
++ mdata->operator=(*(DcmElement *)(stack.top()));
+ }
+ stack.clear();
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTType.getTag(),
+@@ -879,11 +885,13 @@ OFCondition DcmPresentationState::createFromImage(
+ {
+ item = seq->getItem(0);
+ stack.clear();
+- // LUTDescriptor can be US or SS. For now we only handle US.
++ // LUTDescriptor can be US or SS
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTDescriptor.getTag(),
+- stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_SS))
+ {
+- modalityLUTDescriptor = *((DcmUnsignedShort *)(stack.top()));
++ // We explicitly use DcmElement::operator=(), which works for US and SS
++ DcmElement *mLUTDescriptor = &modalityLUTDescriptor;
++ mLUTDescriptor->operator=(* OFstatic_cast(DcmElement *, stack.top()));
+ }
+ stack.clear();
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTExplanation.getTag(),
+@@ -895,9 +903,11 @@ OFCondition DcmPresentationState::createFromImage(
+
+ // LUTData can be OW, US or SS. For now we only handle US.
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTData.getTag(),
+- stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US))
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_OW))
+ {
+- modalityLUTData = *((DcmUnsignedShort *)(stack.top()));
++ // we deliberately call DcmElement::operator=() here, which will work for both DcmUnsignedShort and DcmOtherByteOtherWord parameters
++ DcmElement *mdata = &modalityLUTData;
++ mdata->operator=(*(DcmElement *)(stack.top()));
+ }
+ stack.clear();
+ if ((EC_Normal == item->search((DcmTagKey &)modalityLUTType.getTag(),
+@@ -1247,10 +1257,16 @@ OFCondition DcmPresentationState::write(DcmItem &dset, OFBool replaceSOPInstance
+ dseq = new DcmSequenceOfItems(DCM_ModalityLUTSequence);
+ if (dseq)
+ {
+- delem = new DcmUnsignedShort(modalityLUTDescriptor);
++ // we clone modalityLUTDescriptor in order to retain the VR (US or SS)
++ delem = OFstatic_cast(DcmElement *, modalityLUTDescriptor.clone());
+ if (delem) ditem->insert(delem, OFTrue /*replaceOld*/); else result=EC_MemoryExhausted;
+- delem = new DcmUnsignedShort(modalityLUTData);
++
++ // we write LUTData as OW in order to avoid the 64 kByte limit for US
++ delem = new DcmOtherByteOtherWord(DCM_LUTData);
++ delem->operator=(modalityLUTData);
++ OFstatic_cast(DcmOtherByteOtherWord *, delem)->setVR(EVR_OW);
+ if (delem) ditem->insert(delem, OFTrue /*replaceOld*/); else result=EC_MemoryExhausted;
++
+ delem = new DcmLongString(modalityLUTType);
+ if (delem) ditem->insert(delem, OFTrue /*replaceOld*/); else result=EC_MemoryExhausted;
+ if (modalityLUTExplanation.getLength() >0)
+diff --git a/dcmpstat/libsrc/dvpspl.cc b/dcmpstat/libsrc/dvpspl.cc
+index ec4cccf973..f5574ab337 100644
+--- a/dcmpstat/libsrc/dvpspl.cc
++++ b/dcmpstat/libsrc/dvpspl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1999-2018, OFFIS e.V.
++ * Copyright (C) 1999-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -24,6 +24,7 @@
+ #include "dcmtk/dcmdata/dcdeftag.h"
+ #include "dcmtk/dcmdata/dcsequen.h"
+ #include "dcmtk/dcmdata/dcvrcs.h"
++#include "dcmtk/dcmdata/dcvrobow.h"
+ #include "dcmtk/dcmpstat/dvpspl.h"
+ #include "dcmtk/dcmpstat/dvpsdef.h" /* for constants and macros */
+ #include "dcmtk/dcmnet/dimse.h"
+@@ -79,29 +80,36 @@ OFCondition DVPSPresentationLUT::read(DcmItem &dset, OFBool withSOPInstance)
+ if (result==EC_Normal)
+ {
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_PresentationLUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_PresentationLUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+ {
+ item = seq->getItem(0);
+ stack.clear();
+- if (EC_Normal == item->search((DcmTagKey &)presentationLUTDescriptor.getTag(),
+- stack, ESM_fromHere, OFFalse))
++
++ // LUTDescriptor can be US or SS
++ if ((EC_Normal == item->search((DcmTagKey &)presentationLUTDescriptor.getTag(),
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_SS))
+ {
+- presentationLUTDescriptor = *((DcmUnsignedShort *)(stack.top()));
++ // We explicitly use DcmElement::operator=(), which works for US and SS
++ DcmElement *pLUTDescriptor = &presentationLUTDescriptor;
++ pLUTDescriptor->operator=(* OFstatic_cast(DcmElement *, stack.top()));
+ }
++
+ stack.clear();
+ if (EC_Normal == item->search((DcmTagKey &)presentationLUTExplanation.getTag(),
+- stack, ESM_fromHere, OFFalse))
++ stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_LO))
+ {
+ presentationLUTExplanation = *((DcmLongString *)(stack.top()));
+ }
+ stack.clear();
+ if (EC_Normal == item->search((DcmTagKey &)presentationLUTData.getTag(),
+- stack, ESM_fromHere, OFFalse))
++ stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_OW))
+ {
+- presentationLUTData = *((DcmUnsignedShort *)(stack.top()));
++ // we deliberately call DcmElement::operator=() here, which will work for both DcmUnsignedShort and DcmOtherByteOtherWord parameters
++ DcmElement *pldata = &presentationLUTData;
++ pldata->operator=(*(DcmElement *)(stack.top()));
+ }
+ } else {
+ result=EC_TagNotFound;
+@@ -187,10 +195,16 @@ OFCondition DVPSPresentationLUT::write(DcmItem &dset, OFBool withSOPInstance)
+ dseq = new DcmSequenceOfItems(DCM_PresentationLUTSequence);
+ if (dseq)
+ {
+- delem = new DcmUnsignedShort(presentationLUTDescriptor);
++ // we clone presentationLUTDescriptor in order to retain the VR (US or SS)
++ delem = OFstatic_cast(DcmElement *, presentationLUTDescriptor.clone());
+ if (delem) ditem->insert(delem, OFTrue /*replaceOld*/); else result=EC_MemoryExhausted;
+- delem = new DcmUnsignedShort(presentationLUTData);
++
++ // we write LUTData as OW in order to avoid the 64 kByte limit for US
++ delem = new DcmOtherByteOtherWord(DCM_LUTData);
++ delem->operator=(presentationLUTData);
++ OFstatic_cast(DcmOtherByteOtherWord *, delem)->setVR(EVR_OW);
+ if (delem) ditem->insert(delem, OFTrue /*replaceOld*/); else result=EC_MemoryExhausted;
++
+ if (presentationLUTExplanation.getLength() >0)
+ {
+ delem = new DcmLongString(presentationLUTExplanation);
+diff --git a/dcmpstat/libsrc/dvpssv.cc b/dcmpstat/libsrc/dvpssv.cc
+index 8e3d49bd4f..4a7fd0e309 100644
+--- a/dcmpstat/libsrc/dvpssv.cc
++++ b/dcmpstat/libsrc/dvpssv.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2018, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -23,6 +23,7 @@
+ #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
+ #include "dcmtk/dcmdata/dcdeftag.h"
+ #include "dcmtk/dcmdata/dcsequen.h"
++#include "dcmtk/dcmdata/dcvrobow.h"
+ #include "dcmtk/dcmpstat/dvpssv.h"
+ #include "dcmtk/dcmpstat/dvpsri.h" /* for DVPSReferencedImage */
+ #include "dcmtk/dcmpstat/dvpsrsl.h" /* DVPSReferencedSeries_PList */
+@@ -75,29 +76,36 @@ OFCondition DVPSSoftcopyVOI::read(DcmItem &dset)
+ if (result==EC_Normal)
+ {
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() ==1)
+ {
+ item = seq->getItem(0);
+ stack.clear();
+- if (EC_Normal == item->search((DcmTagKey &)voiLUTDescriptor.getTag(),
+- stack, ESM_fromHere, OFFalse))
++
++ // LUTDescriptor can be US or SS
++ if ((EC_Normal == item->search((DcmTagKey &)voiLUTDescriptor.getTag(),
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_SS))
+ {
+- voiLUTDescriptor = *((DcmUnsignedShort *)(stack.top()));
++ // We explicitly use DcmElement::operator=(), which works for US and SS
++ DcmElement *vLUTDescriptor = &voiLUTDescriptor;
++ vLUTDescriptor->operator=(* OFstatic_cast(DcmElement *, stack.top()));
+ }
++
+ stack.clear();
+ if (EC_Normal == item->search((DcmTagKey &)voiLUTExplanation.getTag(),
+- stack, ESM_fromHere, OFFalse))
++ stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_LO))
+ {
+ voiLUTExplanation = *((DcmLongString *)(stack.top()));
+ }
+ stack.clear();
+ if (EC_Normal == item->search((DcmTagKey &)voiLUTData.getTag(),
+- stack, ESM_fromHere, OFFalse))
++ stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_OW))
+ {
+- voiLUTData = *((DcmUnsignedShort *)(stack.top()));
++ // we deliberately call DcmElement::operator=() here, which will work for both DcmUnsignedShort and DcmOtherByteOtherWord parameters
++ DcmElement *vldata = &voiLUTData;
++ vldata->operator=(*(DcmElement *)(stack.top()));
+ }
+ } else {
+ result=EC_TagNotFound;
+@@ -177,10 +185,16 @@ OFCondition DVPSSoftcopyVOI::write(DcmItem &dset)
+ dseq = new DcmSequenceOfItems(DCM_VOILUTSequence);
+ if (dseq)
+ {
+- delem = new DcmUnsignedShort(voiLUTDescriptor);
++ // we clone voiLUTDescriptor in order to retain the VR (US or SS)
++ delem = OFstatic_cast(DcmElement *, voiLUTDescriptor.clone());
+ if (delem) ditem->insert(delem, OFTrue /*replaceOld*/); else result=EC_MemoryExhausted;
+- delem = new DcmUnsignedShort(voiLUTData);
++
++ // we write LUTData as OW in order to avoid the 64 kByte limit for US
++ delem = new DcmOtherByteOtherWord(DCM_LUTData);
++ delem->operator=(voiLUTData);
++ OFstatic_cast(DcmOtherByteOtherWord *, delem)->setVR(EVR_OW);
+ if (delem) ditem->insert(delem, OFTrue /*replaceOld*/); else result=EC_MemoryExhausted;
++
+ if (voiLUTExplanation.getLength() >0)
+ {
+ delem = new DcmLongString(voiLUTExplanation);
+diff --git a/dcmpstat/libsrc/dvpssvl.cc b/dcmpstat/libsrc/dvpssvl.cc
+index d1532db5c2..efcb6a26be 100644
+--- a/dcmpstat/libsrc/dvpssvl.cc
++++ b/dcmpstat/libsrc/dvpssvl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1999-2023, OFFIS e.V.
++ * Copyright (C) 1999-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -72,7 +72,7 @@ OFCondition DVPSSoftcopyVOI_PList::read(DcmItem &dset)
+ DcmSequenceOfItems *dseq=NULL;
+ DcmItem *ditem=NULL;
+
+- if (EC_Normal == dset.search(DCM_SoftcopyVOILUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_SoftcopyVOILUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ dseq=(DcmSequenceOfItems *)stack.top();
+ if (dseq)
+@@ -249,29 +249,36 @@ OFCondition DVPSSoftcopyVOI_PList::createFromImage(
+ if (result==EC_Normal)
+ {
+ stack.clear();
+- if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dset.search(DCM_VOILUTSequence, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_SQ))
+ {
+ seq=(DcmSequenceOfItems *)stack.top();
+ if (seq->card() > 0)
+ {
+ item = seq->getItem(0);
+ stack.clear();
+- if (EC_Normal == item->search((DcmTagKey &)voiLUTDescriptor.getTag(),
+- stack, ESM_fromHere, OFFalse))
++
++ // LUTDescriptor can be US or SS
++ if ((EC_Normal == item->search((DcmTagKey &)voiLUTDescriptor.getTag(),
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_SS))
+ {
+- voiLUTDescriptor = *((DcmUnsignedShort *)(stack.top()));
++ // We explicitly use DcmElement::operator=(), which works for US and SS
++ DcmElement *vLUTDescriptor = &voiLUTDescriptor;
++ vLUTDescriptor->operator=(* OFstatic_cast(DcmElement *, stack.top()));
+ }
++
+ stack.clear();
+ if (EC_Normal == item->search((DcmTagKey &)voiLUTExplanation.getTag(),
+- stack, ESM_fromHere, OFFalse))
++ stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_LO))
+ {
+ voiLUTExplanation = *((DcmLongString *)(stack.top()));
+ }
+ stack.clear();
+ if (EC_Normal == item->search((DcmTagKey &)voiLUTData.getTag(),
+- stack, ESM_fromHere, OFFalse))
++ stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_OW))
+ {
+- voiLUTData = *((DcmUnsignedShort *)(stack.top()));
++ // we deliberately call DcmElement::operator=() here, which will work for both DcmUnsignedShort and DcmOtherByteOtherWord parameters
++ DcmElement *vldata = &voiLUTData;
++ vldata->operator=(*(DcmElement *)(stack.top()));
+ }
+ } else result=EC_TagNotFound;
+ }
+diff --git a/dcmpstat/libsrc/dvpstat.cc b/dcmpstat/libsrc/dvpstat.cc
+index ce2f5ad5ff..4bfe8f9cbd 100644
+--- a/dcmpstat/libsrc/dvpstat.cc
++++ b/dcmpstat/libsrc/dvpstat.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1998-2021, OFFIS e.V.
++ * Copyright (C) 1998-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -578,14 +578,14 @@ OFCondition DVPresentationState::attachImage(DcmDataset *dataset, OFBool transfe
+ currentImageSelectedFrame = 1; // default: first frame
+
+ // get Modality
+- if (EC_Normal == dataset->search(DCM_Modality, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dataset->search(DCM_Modality, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_CS))
+ {
+ currentImageModality = *((DcmCodeString *)(stack.top()));
+ }
+ stack.clear();
+
+ // determine default Presentation LUT Shape
+- if (EC_Normal == dataset->search(DCM_PhotometricInterpretation, stack, ESM_fromHere, OFFalse))
++ if (EC_Normal == dataset->search(DCM_PhotometricInterpretation, stack, ESM_fromHere, OFFalse) && (stack.top()->ident() == EVR_CS))
+ {
+ DcmCodeString *photometricInterpretation = (DcmCodeString *)(stack.top());
+ if (photometricInterpretation->getVM() == 1)
+@@ -598,12 +598,12 @@ OFCondition DVPresentationState::attachImage(DcmDataset *dataset, OFBool transfe
+ stack.clear();
+
+ // get SOP class UID and SOP instance UID.
+- if ((EC_Normal == result)&&(EC_Normal == dataset->search(DCM_SOPClassUID, stack, ESM_fromHere, OFFalse)))
++ if ((EC_Normal == result)&&(EC_Normal == dataset->search(DCM_SOPClassUID, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_UI))
+ {
+ result = ((DcmUniqueIdentifier *)(stack.top()))->getString(currentImageSOPClassUID);
+ }
+ stack.clear();
+- if ((EC_Normal == result)&&(EC_Normal == dataset->search(DCM_SOPInstanceUID, stack, ESM_fromHere, OFFalse)))
++ if ((EC_Normal == result)&&(EC_Normal == dataset->search(DCM_SOPInstanceUID, stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_UI))
+ {
+ result = ((DcmUniqueIdentifier *)(stack.top()))->getString(currentImageSOPInstanceUID);
+ }
+@@ -1124,40 +1124,36 @@ OFCondition DVPresentationState::setGammaVOILUT(double gammaValue, DVPSObjectApp
+ numEntries16 = (Uint16)numberOfEntries;
+
+ /* LUT Descriptor */
+- DcmElement *lutDescriptor = NULL;
+- if (firstMapped < 0)
++ DcmUnsignedShort *lutDescriptor = new DcmUnsignedShort(DcmTag(DCM_LUTDescriptor, EVR_US));
++ if (lutDescriptor == NULL) status = EC_MemoryExhausted;
++ else
+ {
+- // LUT Descriptor is SS
+- lutDescriptor = new DcmSignedShort(DcmTag(DCM_LUTDescriptor, EVR_SS));
+- if (lutDescriptor != NULL)
++ if (firstMapped < 0)
+ {
+- status = lutDescriptor->putSint16((Sint16)numEntries16, 0);
+- if (EC_Normal == status)
+- status = lutDescriptor->putSint16((Sint16)firstMapped, 1);
+- if (EC_Normal == status)
+- status = lutDescriptor->putSint16((Sint16)numberOfBits, 2);
+- } else
+- status = EC_MemoryExhausted;
+- } else {
+- // LUT Descriptor is US
+- lutDescriptor = new DcmUnsignedShort(DcmTag(DCM_LUTDescriptor, EVR_US));
+- if (lutDescriptor != NULL)
+- {
+- status = lutDescriptor->putUint16(numEntries16, 0);
+- if (EC_Normal == status)
+- status = lutDescriptor->putUint16((Uint16)firstMapped, 1);
+- if (EC_Normal == status)
+- status = lutDescriptor->putUint16((Uint16)numberOfBits, 2);
+- } else
+- status = EC_MemoryExhausted;
++ // LUT Descriptor is SS
++ DcmSignedShort ldesc(DcmTag(DCM_LUTDescriptor, EVR_SS));
++ status = ldesc.putSint16((Sint16)numEntries16, 0);
++ if (EC_Normal == status) status = ldesc.putSint16((Sint16)firstMapped, 1);
++ if (EC_Normal == status) status = ldesc.putSint16((Sint16)numberOfBits, 2);
++ if (EC_Normal == status)
++ {
++ // copy content of SS element into DcmUnsignedShort using DcmElement::operator=
++ DcmElement *ld = lutDescriptor;
++ ld->operator=(ldesc);
++ }
++ } else {
++ // LUT Descriptor is US
++ status = lutDescriptor->putUint16(numEntries16, 0);
++ if (EC_Normal == status) status = lutDescriptor->putUint16((Uint16)firstMapped, 1);
++ if (EC_Normal == status) status = lutDescriptor->putUint16((Uint16)numberOfBits, 2);
++ }
+ }
+
+ /* LUT Data */
+- DcmElement *lutData = NULL;
++ DcmUnsignedShort *lutData = NULL;
+ if (status == EC_Normal)
+ {
+- // LUT Data as OW, because of max size = 64K
+- lutData = new DcmOtherByteOtherWord(DcmTag(DCM_LUTData, EVR_OW));
++ lutData = new DcmUnsignedShort(DcmTag(DCM_LUTData, EVR_US));
+ if (lutData != NULL)
+ status = lutData->putUint16Array(data, numberOfEntries);
+ else
+@@ -1186,15 +1182,14 @@ OFCondition DVPresentationState::setGammaVOILUT(double gammaValue, DVPSObjectApp
+ if (status == EC_Normal)
+ {
+ if ((lutDescriptor != NULL) && (lutData != NULL) && (lutExplanation != NULL))
+- status = setVOILUT(*(DcmUnsignedShort *)lutDescriptor, *(DcmUnsignedShort *)lutData, *lutExplanation, applicability);
++ status = setVOILUT(*lutDescriptor, *lutData, *lutExplanation, applicability);
+ }
+
+ /* delete temporary dcmtk structures */
+ delete lutDescriptor;
+ delete lutData;
+ delete lutExplanation;
+- } else
+- status = EC_MemoryExhausted;
++ } else status = EC_MemoryExhausted;
+ delete[] data;
+ }
+ return status;
+diff --git a/dcmpstat/libsrc/dvpsvl.cc b/dcmpstat/libsrc/dvpsvl.cc
+index b10b83f20d..fdba0a0e06 100644
+--- a/dcmpstat/libsrc/dvpsvl.cc
++++ b/dcmpstat/libsrc/dvpsvl.cc
+@@ -59,9 +59,24 @@ OFCondition DVPSVOILUT::read(DcmItem &dset)
+ OFCondition result = EC_Normal;
+ DcmStack stack;
+
+- READ_FROM_DATASET(DcmUnsignedShort, EVR_US, voiLUTDescriptor)
++ // LUTDescriptor can be US or SS
++ if ((EC_Normal == dset.search((DcmTagKey &)voiLUTDescriptor.getTag(),
++ stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_SS))
++ {
++ // We explicitly use DcmElement::operator=(), which works for US and SS
++ DcmElement *vLUTDescriptor = &voiLUTDescriptor;
++ vLUTDescriptor->operator=(* OFstatic_cast(DcmElement *, stack.top()));
++ }
++
+ READ_FROM_DATASET(DcmLongString, EVR_LO, voiLUTExplanation)
+- READ_FROM_DATASET(DcmUnsignedShort, EVR_US, voiLUTData)
++
++ stack.clear();
++ if ((EC_Normal == dset.search((DcmTagKey &)voiLUTData.getTag(), stack, ESM_fromHere, OFFalse)) && (stack.top()->ident() == EVR_US || stack.top()->ident() == EVR_OW))
++ {
++ // we deliberately call DcmElement::operator=() here, which will work for both DcmUnsignedShort and DcmOtherByteOtherWord parameters
++ DcmElement *vldata = &voiLUTData;
++ vldata->operator=(*(DcmElement *)(stack.top()));
++ }
+
+ if (EC_Normal == result)
+ {
--- /dev/null
+From 7d54f8efec995e5601d089fa17b0625c2b41af23 Mon Sep 17 00:00:00 2001
+From: Joerg Riesmeier <dicom@jriesmeier.com>
+Date: Mon, 22 Apr 2024 12:11:11 +0200
+Subject: [PATCH] Fixed wrong error handling (previous commit).
+
+Fixed wrong error handling introduced with the previous commit.
+---
+ dcmrt/libsrc/drttypes.cc | 6 +++---
+ dcmsr/libsrc/dsrtypes.cc | 32 ++++++++++++++++++++------------
+ 2 files changed, 23 insertions(+), 15 deletions(-)
+
+diff --git a/dcmrt/libsrc/drttypes.cc b/dcmrt/libsrc/drttypes.cc
+index 77ff1674c..097ab9727 100644
+--- a/dcmrt/libsrc/drttypes.cc
++++ b/dcmrt/libsrc/drttypes.cc
+@@ -210,11 +210,11 @@ OFCondition DRTTypes::getAndCheckStringValueFromDataset(DcmItem &dataset,
+ {
+ DcmStack stack;
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good() && stack.top()->isElement())
++ if (result.good())
+ {
+- DcmElement *element = OFstatic_cast(DcmElement *, stack.top());
+- if (element != NULL)
++ if (stack.top()->isElement())
+ {
++ DcmElement *element = OFstatic_cast(DcmElement *, stack.top());
+ if (checkElementValue(*element, vm, type, result, moduleName))
+ result = element->getOFString(stringValue, 0);
+ else
+diff --git a/dcmsr/libsrc/dsrtypes.cc b/dcmsr/libsrc/dsrtypes.cc
+index a9d621859..166bfabff 100644
+--- a/dcmsr/libsrc/dsrtypes.cc
++++ b/dcmsr/libsrc/dsrtypes.cc
+@@ -1178,13 +1178,17 @@ OFCondition DSRTypes::getAndCheckElementFromDataset(DcmItem &dataset,
+ DcmStack stack;
+ const DcmTagKey tagKey = delem.getTag();
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good() && stack.top()->isElement())
++ if (result.good())
+ {
+- /* copy object from search stack */
+- result = delem.copyFrom(*stack.top());
+- /* we need a reference to the original element in order to determine the SpecificCharacterSet */
+- if (!checkElementValue(OFstatic_cast(DcmElement *, stack.top()), tagKey, vm, type, result, moduleName, acceptViolation))
+- result = SR_EC_InvalidValue;
++ if (stack.top()->isElement())
++ {
++ /* copy object from search stack */
++ result = delem.copyFrom(*stack.top());
++ /* we need a reference to the original element in order to determine the SpecificCharacterSet */
++ if (!checkElementValue(OFstatic_cast(DcmElement *, stack.top()), tagKey, vm, type, result, moduleName, acceptViolation))
++ result = SR_EC_InvalidValue;
++ } else
++ result = EC_CorruptedData;
+ }
+ /* the element could not be found in the dataset */
+ else if (!checkElementValue(delem, vm, type, result, moduleName, acceptViolation))
+@@ -1203,13 +1207,17 @@ OFCondition DSRTypes::getAndCheckStringValueFromDataset(DcmItem &dataset,
+ {
+ DcmStack stack;
+ OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
+- if (result.good() && stack.top()->isElement())
++ if (result.good())
+ {
+- DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
+- /* we need a reference to the original element in order to determine the SpecificCharacterSet */
+- if (!checkElementValue(delem, tagKey, vm, type, result, moduleName, acceptViolation))
+- result = SR_EC_InvalidValue;
+- delem->getOFString(stringValue, 0);
++ if (stack.top()->isElement())
++ {
++ DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
++ /* we need a reference to the original element in order to determine the SpecificCharacterSet */
++ if (!checkElementValue(delem, tagKey, vm, type, result, moduleName, acceptViolation))
++ result = SR_EC_InvalidValue;
++ delem->getOFString(stringValue, 0);
++ } else
++ result = EC_CorruptedData;
+ } else {
+ if ((type == "1") || (type == "2"))
+ {
--- /dev/null
+From c78e434c0c5f9d932874f0b17a8b4ce305ca01f5 Mon Sep 17 00:00:00 2001
+From: Marco Eichelberg <dicom@offis.de>
+Date: Wed, 13 Mar 2024 17:15:58 +0100
+Subject: [PATCH] Fixed two segmentation faults.
+
+Fixed two segmentations faults that could occur while processing an
+invalid incoming DIMSE message due to insufficient error handling
+causing a de-referenced NULL pointer.
+
+Thanks to Nils Bars <nils.bars@rub.de> for the bug report and sample files.
+
+This closes DCMTK issue #1114.
+---
+ dcmdata/libsrc/dcelem.cc | 9 ++++++++-
+ dcmnet/libsrc/dimcmd.cc | 33 ++++++++++++++++++---------------
+ 2 files changed, 26 insertions(+), 16 deletions(-)
+
+--- dcmtk.orig/dcmdata/libsrc/dcelem.cc
++++ dcmtk/dcmdata/libsrc/dcelem.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2023, OFFIS e.V.
++ * Copyright (C) 1994-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -717,6 +717,13 @@
+ if (isStreamNew)
+ delete readStream;
+ }
++ else
++ {
++ errorFlag = EC_InvalidStream; // incomplete dataset read from stream
++ DCMDATA_ERROR("DcmElement: " << getTagName() << " " << getTag()
++ << " larger (" << getLengthField() << ") than remaining bytes ("
++ << getTransferredBytes() << ") in file, premature end of stream");
++ }
+ }
+ /* return result value */
+ return errorFlag;
+--- dcmtk.orig/dcmnet/libsrc/dimcmd.cc
++++ dcmtk/dcmnet/libsrc/dimcmd.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2022, OFFIS e.V.
++ * Copyright (C) 1994-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were partly developed by
+@@ -207,22 +207,25 @@
+ return parseErrorWithMsg("dimcmd:getString: string too small", t);
+ } else {
+ ec = elem->getString(aString);
+- strncpy(s, aString, maxlen);
+- if (spacePadded)
++ if (ec.good())
+ {
+- /* before we remove leading and tailing spaces we want to know
+- * whether the string is actually space padded. Required to communicate
+- * with dumb peers which send space padded UIDs and fail if they
+- * receive correct UIDs back.
+- *
+- * This test can only detect space padded strings if
+- * dcmEnableAutomaticInputDataCorrection is false; otherwise the padding
+- * has already been removed by dcmdata at this stage.
+- */
+- size_t s_len = strlen(s);
+- if ((s_len > 0)&&(s[s_len-1] == ' ')) *spacePadded = OFTrue; else *spacePadded = OFFalse;
++ strncpy(s, aString, maxlen);
++ if (spacePadded)
++ {
++ /* before we remove leading and tailing spaces we want to know
++ * whether the string is actually space padded. Required to communicate
++ * with dumb peers which send space padded UIDs and fail if they
++ * receive correct UIDs back.
++ *
++ * This test can only detect space padded strings if
++ * dcmEnableAutomaticInputDataCorrection is false; otherwise the padding
++ * has already been removed by dcmdata at this stage.
++ */
++ size_t s_len = strlen(s);
++ if ((s_len > 0)&&(s[s_len-1] == ' ')) *spacePadded = OFTrue; else *spacePadded = OFFalse;
++ }
++ DU_stripLeadingAndTrailingSpaces(s);
+ }
+- DU_stripLeadingAndTrailingSpaces(s);
+ }
+ }
+ return (ec.good())? ec : DIMSE_PARSEFAILED;
--- /dev/null
+From 66c317feae446deda1a389226aa24c95a0eeac4c Mon Sep 17 00:00:00 2001
+From: Marco Eichelberg <dicom@offis.de>
+Date: Wed, 13 Mar 2024 23:03:40 +0100
+Subject: [PATCH] Fixed DcmDecimalString unit tests.
+
+---
+ dcmdata/tests/tvrds.cc | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/dcmdata/tests/tvrds.cc b/dcmdata/tests/tvrds.cc
+index a9132a341..0e929304d 100644
+--- a/dcmdata/tests/tvrds.cc
++++ b/dcmdata/tests/tvrds.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2011-2020, OFFIS e.V.
++ * Copyright (C) 2011-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -30,7 +30,7 @@
+
+ OFTEST(dcmdata_decimalString_1)
+ {
+- DcmDecimalString decStr(DCM_ContourData, EVR_DS);
++ DcmDecimalString decStr(DCM_ContourData);
+ OFVector<Float64> doubleVals;
+ OFCHECK(decStr.putString("1\\2.0\\3.5\\-4.99\\+500.005\\6.66E-01").good());
+ OFCHECK(decStr.getFloat64Vector(doubleVals).good());
+@@ -45,7 +45,7 @@ OFTEST(dcmdata_decimalString_1)
+
+ OFTEST(dcmdata_decimalString_2)
+ {
+- DcmDecimalString decStr(DCM_ContourData, EVR_DS);
++ DcmDecimalString decStr(DCM_ContourData);
+ OFVector<Float64> doubleVals;
+ /* insert a NULL byte into the string */
+ OFCHECK(decStr.putString("1\\2.0\\3.5\\-4.99\0\\+500.005\\6.66E-01", 34).good());
+@@ -61,7 +61,7 @@ OFTEST(dcmdata_decimalString_2)
+
+ OFTEST(dcmdata_decimalString_3)
+ {
+- DcmDecimalString decStr(DCM_ContourData, EVR_DS);
++ DcmDecimalString decStr(DCM_ContourData);
+ OFVector<Float64> doubleVals;
+ /* insert a NULL byte into the string */
+ OFCHECK(decStr.putOFStringArray(OFString("1\\2.0\\3.5\\-4.99\0\\+500.005\\6.66E-01", 34)).good());
+@@ -77,7 +77,7 @@ OFTEST(dcmdata_decimalString_3)
+
+ OFTEST(dcmdata_decimalString_4)
+ {
+- DcmDecimalString decStr(DCM_ContourData, EVR_DS);
++ DcmDecimalString decStr(DCM_ContourData);
+ OFVector<Float64> doubleVals;
+ OFCHECK(decStr.putString("1\\2.0\\3.5\\-4.99\\+500.005\\6.66E-01\\").good());
+ OFCHECK_EQUAL(decStr.getVM(), 7);
+@@ -96,7 +96,7 @@ OFTEST(dcmdata_decimalString_putFloat64)
+ {
+ // Test insertion in the beginning
+ OFString testStr;
+- DcmDecimalString decStr(DCM_ContourData, EVR_DS);
++ DcmDecimalString decStr(DCM_ContourData);
+ OFCHECK(decStr.putFloat64(0, 0).good());
+ decStr.getOFStringArray(testStr);
+ OFCHECK(testStr == "0");
--- /dev/null
+From 855ee5eacad12b4ef39d36a78c9c24d038c4a231 Mon Sep 17 00:00:00 2001
+From: Michael Onken <onken@open-connections.de>
+Date: Tue, 20 Feb 2024 10:50:28 +0100
+Subject: Fixed possible overflows when allocating memory.
+
+Thanks to GitHub user "bananabr" (Daniel Berredo) for the report and
+suggested patch.
+---
+ dcmect/libsrc/enhanced_ct.cc | 14 +-
+ dcmect/tests/CMakeLists.txt | 1 +
+ dcmect/tests/Makefile.dep | 151 +++++++++++++++
+ dcmect/tests/Makefile.in | 4 +-
+ dcmect/tests/t_overflow.cc | 362 +++++++++++++++++++++++++++++++++++
+ dcmect/tests/tests.cc | 3 +-
+ 6 files changed, 531 insertions(+), 4 deletions(-)
+ create mode 100644 dcmect/tests/t_overflow.cc
+
+diff --git a/dcmect/libsrc/enhanced_ct.cc b/dcmect/libsrc/enhanced_ct.cc
+index 619374290..47d6335f0 100644
+--- a/dcmect/libsrc/enhanced_ct.cc
++++ b/dcmect/libsrc/enhanced_ct.cc
+@@ -24,6 +24,7 @@
+ #include "dcmtk/dcmect/types.h"
+ #include "dcmtk/dcmfg/concatenationcreator.h"
+ #include "dcmtk/dcmfg/concatenationloader.h"
++#include "dcmtk/dcmfg/fgtypes.h"
+ #include "dcmtk/dcmiod/iodutil.h"
+ #include "dcmtk/dcmiod/modimagepixel.h"
+
+@@ -100,8 +101,19 @@ struct EctEnhancedCT::WriteVisitor
+ m_CT.getRows(rows);
+ m_CT.getColumns(cols);
+ const size_t numFrames = m_CT.m_Frames.size();
++ if (numFrames > 2147483647)
++ {
++ DCMECT_ERROR("More than 2147483647 frames provided");
++ return FG_EC_PixelDataTooLarge;
++ }
++ const size_t numPixelsFrame = OFstatic_cast(size_t, rows) * OFstatic_cast(size_t, cols);
+ const size_t numBytesFrame = m_CT.m_Frames[0]->length;
+- const size_t numPixelsFrame = rows * cols;
++ if (numBytesFrame != numPixelsFrame * 2)
++ {
++ DCMECT_ERROR("Invalid number of bytes per frame: Expected " << numPixelsFrame * 2 << " but got "
++ << numBytesFrame << " frame pixel data");
++ return ECT_InvalidPixelInfo;
++ }
+ // Creates the correct pixel data element, based on the image pixel module used.
+ DcmPixelData* pixData = new DcmPixelData(DCM_PixelData);
+ OFCondition result;
+diff --git a/dcmect/tests/CMakeLists.txt b/dcmect/tests/CMakeLists.txt
+index 5d66b1145..032553414 100644
+--- a/dcmect/tests/CMakeLists.txt
++++ b/dcmect/tests/CMakeLists.txt
+@@ -2,6 +2,7 @@
+ DCMTK_ADD_EXECUTABLE(dcmect_tests
+ tests.cc
+ t_huge_concat.cc
++ t_overflow.cc
+ t_roundtrip.cc
+ )
+
+diff --git a/dcmect/tests/Makefile.dep b/dcmect/tests/Makefile.dep
+index 9d26f581c..dfb50b812 100644
+--- a/dcmect/tests/Makefile.dep
++++ b/dcmect/tests/Makefile.dep
+@@ -192,6 +192,157 @@ t_huge_concat.o: t_huge_concat.cc \
+ ../../dcmfg/include/dcmtk/dcmfg/fgrealworldvaluemapping.h \
+ ../../dcmiod/include/dcmtk/dcmiod/iodcontentitemmacro.h \
+ ../../dcmfg/include/dcmtk/dcmfg/fgtemporalposition.h
++t_overflow.o: t_overflow.cc ../../config/include/dcmtk/config/osconfig.h \
++ ../include/dcmtk/dcmect/enhanced_ct.h ../include/dcmtk/dcmect/def.h \
++ ../../ofstd/include/dcmtk/ofstd/ofexport.h \
++ ../include/dcmtk/dcmect/types.h ../../oflog/include/dcmtk/oflog/oflog.h \
++ ../../oflog/include/dcmtk/oflog/logger.h \
++ ../../oflog/include/dcmtk/oflog/config.h \
++ ../../ofstd/include/dcmtk/ofstd/ofdefine.h \
++ ../../ofstd/include/dcmtk/ofstd/ofcast.h \
++ ../../ofstd/include/dcmtk/ofstd/ofstdinc.h \
++ ../../oflog/include/dcmtk/oflog/config/defines.h \
++ ../../oflog/include/dcmtk/oflog/helpers/threadcf.h \
++ ../../oflog/include/dcmtk/oflog/loglevel.h \
++ ../../ofstd/include/dcmtk/ofstd/ofvector.h \
++ ../../ofstd/include/dcmtk/ofstd/oftypes.h \
++ ../../ofstd/include/dcmtk/ofstd/ofstream.h \
++ ../../oflog/include/dcmtk/oflog/tstring.h \
++ ../../ofstd/include/dcmtk/ofstd/ofstring.h \
++ ../../oflog/include/dcmtk/oflog/tchar.h \
++ ../../oflog/include/dcmtk/oflog/spi/apndatch.h \
++ ../../oflog/include/dcmtk/oflog/appender.h \
++ ../../ofstd/include/dcmtk/ofstd/ofmem.h \
++ ../../ofstd/include/dcmtk/ofstd/ofutil.h \
++ ../../ofstd/include/dcmtk/ofstd/oftraits.h \
++ ../../ofstd/include/dcmtk/ofstd/variadic/tuplefwd.h \
++ ../../oflog/include/dcmtk/oflog/layout.h \
++ ../../oflog/include/dcmtk/oflog/streams.h \
++ ../../oflog/include/dcmtk/oflog/helpers/pointer.h \
++ ../../oflog/include/dcmtk/oflog/thread/syncprim.h \
++ ../../oflog/include/dcmtk/oflog/spi/filter.h \
++ ../../oflog/include/dcmtk/oflog/helpers/lockfile.h \
++ ../../oflog/include/dcmtk/oflog/spi/logfact.h \
++ ../../oflog/include/dcmtk/oflog/logmacro.h \
++ ../../oflog/include/dcmtk/oflog/helpers/snprintf.h \
++ ../../oflog/include/dcmtk/oflog/tracelog.h \
++ ../../ofstd/include/dcmtk/ofstd/ofcond.h \
++ ../../ofstd/include/dcmtk/ofstd/ofdiag.h \
++ ../../ofstd/include/dcmtk/ofstd/diag/push.def \
++ ../../ofstd/include/dcmtk/ofstd/diag/useafree.def \
++ ../../ofstd/include/dcmtk/ofstd/diag/pop.def \
++ ../../dcmfg/include/dcmtk/dcmfg/fginterface.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fg.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgbase.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcitem.h \
++ ../../ofstd/include/dcmtk/ofstd/offile.h \
++ ../../ofstd/include/dcmtk/ofstd/ofstd.h \
++ ../../ofstd/include/dcmtk/ofstd/oflist.h \
++ ../../ofstd/include/dcmtk/ofstd/oflimits.h \
++ ../../config/include/dcmtk/config/arith.h \
++ ../../ofstd/include/dcmtk/ofstd/oferror.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dctypes.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcdefine.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcobject.h \
++ ../../ofstd/include/dcmtk/ofstd/ofglobal.h \
++ ../../ofstd/include/dcmtk/ofstd/ofthread.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcerror.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcxfer.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvr.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dctag.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dctagkey.h \
++ ../../ofstd/include/dcmtk/ofstd/diag/ignrattr.def \
++ ../../dcmdata/include/dcmtk/dcmdata/dcstack.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dclist.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcpcache.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgtypes.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgdefine.h \
++ ../../ofstd/include/dcmtk/ofstd/ofmap.h \
++ ../../dcmiod/include/dcmtk/dcmiod/iodimage.h \
++ ../../dcmiod/include/dcmtk/dcmiod/iodcommn.h \
++ ../../dcmiod/include/dcmtk/dcmiod/iodrules.h \
++ ../../dcmiod/include/dcmtk/dcmiod/iodtypes.h \
++ ../../dcmiod/include/dcmtk/dcmiod/ioddef.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modcommoninstanceref.h \
++ ../../dcmiod/include/dcmtk/dcmiod/iodmacro.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcdeftag.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrlo.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcchrstr.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcbytstr.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcelem.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvris.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrus.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrlt.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrcs.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrpn.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modbase.h \
++ ../../dcmiod/include/dcmtk/dcmiod/iodreferences.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modequipment.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modfor.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modgeneralseries.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modgeneralstudy.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modpatient.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modpatientstudy.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modsopcommon.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modgeneralimage.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modimagepixelvariant.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modimagepixelbase.h \
++ ../../ofstd/include/dcmtk/ofstd/ofvriant.h \
++ ../../ofstd/include/dcmtk/ofstd/variadic/variant.h \
++ ../../ofstd/include/dcmtk/ofstd/variadic/helpers.h \
++ ../../ofstd/include/dcmtk/ofstd/ofalign.h \
++ ../../ofstd/include/dcmtk/ofstd/diag/cnvrsn.def \
++ ../../ofstd/include/dcmtk/ofstd/diag/vsprfw.def \
++ ../../ofstd/include/dcmtk/ofstd/diag/arrybnds.def \
++ ../../ofstd/include/dcmtk/ofstd/diag/unrefprm.def \
++ ../../dcmiod/include/dcmtk/dcmiod/modacquisitioncontext.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modenhequipment.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modimagepixel.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modmultiframedimension.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modmultiframefg.h \
++ ../../dcmiod/include/dcmtk/dcmiod/modsynchronisation.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrdt.h \
++ ../../ofstd/include/dcmtk/ofstd/ofdatime.h \
++ ../../ofstd/include/dcmtk/ofstd/ofdate.h \
++ ../../ofstd/include/dcmtk/ofstd/oftime.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrds.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrfd.h \
++ ../../ofstd/include/dcmtk/ofstd/oftempf.h \
++ ../../ofstd/include/dcmtk/ofstd/oftest.h \
++ ../../ofstd/include/dcmtk/ofstd/ofconapp.h \
++ ../../ofstd/include/dcmtk/ofstd/ofcmdln.h \
++ ../../ofstd/include/dcmtk/ofstd/ofexbl.h \
++ ../../ofstd/include/dcmtk/ofstd/ofconsol.h \
++ ../../ofstd/include/dcmtk/ofstd/ofexit.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcuid.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcdict.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dchashdi.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcfilefo.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcsequen.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcdatset.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctacquisitiondetails.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctacquisitiontype.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctadditionalxraysource.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrfl.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrsh.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctexposure.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctgeometry.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctimageframetype.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctposition.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctreconstruction.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgcttabledynamics.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgctxraydetails.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgfracon.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrul.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgframeanatomy.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgirradiationeventid.h \
++ ../../dcmdata/include/dcmtk/dcmdata/dcvrui.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgpixeltransform.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgpixmsr.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgplanor.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgplanpo.h \
++ ../../dcmfg/include/dcmtk/dcmfg/fgrealworldvaluemapping.h \
++ ../../dcmiod/include/dcmtk/dcmiod/iodcontentitemmacro.h
+ t_roundtrip.o: t_roundtrip.cc \
+ ../../config/include/dcmtk/config/osconfig.h \
+ ../../ofstd/include/dcmtk/ofstd/ofmem.h \
+diff --git a/dcmect/tests/Makefile.in b/dcmect/tests/Makefile.in
+index da1f74f11..7dda4351f 100644
+--- a/dcmect/tests/Makefile.in
++++ b/dcmect/tests/Makefile.in
+@@ -24,10 +24,10 @@ LIBDIRS = -L$(top_srcdir)/libsrc -L$(ofstddir)/libsrc -L$(oflogdir)/libsrc \
+ -L$(oficonvdir)/libsrc
+ LOCALLIBS = -ldcmect -ldcmfg -ldcmiod -ldcmdata -loflog -lofstd -loficonv \
+ $(ZLIBLIBS) $(CHARCONVLIBS) $(MATHLIBS)
+-LOCALINCLUDES = -I$(top_srcdir)/include -I$(ofstddir)/include -I$(oflogdir)/include \
++LOCALINCLUDES = -I$(top_srcdir)/include -I$(configdir)/include -I$(ofstddir)/include -I$(oflogdir)/include \
+ -I$(dcmdatadir)/include -I$(dcmioddir)/include -I$(dcmfgdir)/include
+
+-test_objs = tests.o t_huge_concat.o t_roundtrip.o
++test_objs = tests.o t_huge_concat.o t_overflow.cc t_roundtrip.o
+ objs = $(test_objs)
+ progs = tests
+
+diff --git a/dcmect/tests/t_overflow.cc b/dcmect/tests/t_overflow.cc
+new file mode 100644
+index 000000000..fcc0e1abb
+--- /dev/null
++++ b/dcmect/tests/t_overflow.cc
+@@ -0,0 +1,362 @@
++/*
++ *
++ * Copyright (C) 2024, OFFIS e.V.
++ * All rights reserved. See COPYRIGHT file for details.
++ *
++ * This software and supporting documentation were developed by
++ *
++ * OFFIS e.V.
++ * R&D Division Health
++ * Escherweg 2
++ * D-26121 Oldenburg, Germany
++ *
++ *
++ * Module: dcmect
++ *
++ * Author: Daniel Berredo / Michael Onken
++ *
++ * Purpose: Tests that check for pixel data overflow conditions
++ *
++ */
++
++
++#include <dcmtk/config/osconfig.h> /* make sure OS specific configuration is included first */
++
++#include <dcmtk/dcmect/enhanced_ct.h>
++
++#include <dcmtk/ofstd/oftempf.h>
++#include <dcmtk/ofstd/oftest.h>
++
++#include <dcmtk/dcmdata/dcdict.h>
++#include <dcmtk/dcmdata/dcfilefo.h>
++
++#include <dcmtk/dcmfg/fgctacquisitiondetails.h>
++#include <dcmtk/dcmfg/fgctacquisitiontype.h>
++#include <dcmtk/dcmfg/fgctadditionalxraysource.h>
++#include <dcmtk/dcmfg/fgctexposure.h>
++#include <dcmtk/dcmfg/fgctgeometry.h>
++#include <dcmtk/dcmfg/fgctimageframetype.h>
++#include <dcmtk/dcmfg/fgctposition.h>
++#include <dcmtk/dcmfg/fgctreconstruction.h>
++#include <dcmtk/dcmfg/fgcttabledynamics.h>
++#include <dcmtk/dcmfg/fgctxraydetails.h>
++#include <dcmtk/dcmfg/fgfracon.h>
++#include <dcmtk/dcmfg/fgframeanatomy.h>
++#include <dcmtk/dcmfg/fgirradiationeventid.h>
++#include <dcmtk/dcmfg/fgpixeltransform.h>
++#include <dcmtk/dcmfg/fgpixmsr.h>
++#include <dcmtk/dcmfg/fgplanor.h>
++#include <dcmtk/dcmfg/fgplanpo.h>
++#include <dcmtk/dcmfg/fgrealworldvaluemapping.h>
++
++static const Uint16 NUM_ROWS = 1024;
++static const Uint16 NUM_COLS = 1;
++static const Uint16 NUM_FRAMES = 2;
++static const size_t NUM_PIXELS_PER_FRAME = 1;
++
++static OFString EXPECTED_DUMP;
++
++static EctEnhancedCT *create();
++static void configureIOD(EctEnhancedCT *ct);
++static void setGenericValues(EctEnhancedCT *ct);
++static void addSharedFGs(EctEnhancedCT *ct);
++static void addFrames(EctEnhancedCT *ct);
++static void addDimensions(EctEnhancedCT *ct);
++
++
++OFTEST(dcmect_overflow)
++{
++ /* make sure data dictionary is loaded */
++ if (!dcmDataDict.isDictionaryLoaded())
++ {
++ OFCHECK(dcmDataDict.isDictionaryLoaded());
++ }
++
++ // Creation
++ EctEnhancedCT *ct = create();
++ configureIOD(ct);
++ setGenericValues(ct);
++ addSharedFGs(ct);
++ addFrames(ct);
++ addDimensions(ct);
++
++ // Write to dataset and compare its dump with expected result
++ DcmFileFormat dcmff;
++
++ OFTempFile tf(O_RDWR, "", "t_overflow", ".dcm");
++ OFCondition result;
++ result = ct->saveFile("output.dcm", EXS_LittleEndianExplicit);
++ OFCHECK_MSG(result == ECT_InvalidPixelInfo, result.text());
++}
++
++static EctEnhancedCT *create()
++{
++ IODEnhGeneralEquipmentModule::EquipmentInfo eq("Open Connections", "OC CT", "4711", "0.1");
++ EctEnhancedCT *ct = NULL;
++ OFCondition result;
++ result = EctEnhancedCT::create(ct,
++ NUM_ROWS,
++ NUM_COLS,
++ OFFalse,
++ EctTypes::E_ImageType1_Original,
++ EctTypes::DT_ImageType3_Volume,
++ EctTypes::DT_ImageType4_Maximum,
++ "1" /* instance number */,
++ EctTypes::E_ContQuali_Research,
++ EctTypes::E_PixelPres_Monochrome,
++ EctTypes::E_VolProps_Volume,
++ EctTypes::DT_VolBasedCalcTechnique_VolumeRender,
++ eq,
++ "20190801120000" /* acquisition date */,
++ 2.0 /* acquisition duration */);
++
++ OFCHECK(result.good());
++ OFCHECK(ct != OFnullptr);
++ return ct;
++}
++
++static void configureIOD(EctEnhancedCT *ct)
++{
++ if (!ct)
++ return;
++}
++
++static void setGenericValues(EctEnhancedCT *ct)
++{
++ if (!ct)
++ return;
++ OFCHECK(ct->getPatient().setPatientName("Bond^James").good());
++ OFCHECK(ct->getPatient().setPatientID("007").good());
++ OFCHECK(ct->getPatient().setPatientBirthDate("19771007").good());
++ OFCHECK(ct->getStudy().setStudyDate("20190801").good());
++ OFCHECK(ct->getStudy().setStudyTime("120000").good());
++ OFCHECK(ct->getStudy().setStudyID("1").good());
++ OFCHECK(ct->getPatientStudy().setPatientAge("040Y").good());
++ OFCHECK(ct->getSeries().setSeriesDescription("Test Description").good());
++ OFCHECK(ct->getSeries().setSeriesNumber("1").good());
++ OFCHECK(ct->getSeries().setPatientPosition("HFS").good());
++
++ // Those values are usually computed automatically. UIDS are generated and date/times are set to current values.
++ // But in order to compare the "old" dump with the freshly created image attributes, we set some values manually,
++ // so that they are not overwritten with new, automatically created values later.
++ OFCHECK(ct->getStudy().setStudyInstanceUID("1.2.276.0.7230010.3.1.2.8323329.14863.1565940357.864811").good());
++ OFCHECK(ct->getFrameOfReference().setFrameOfReferenceUID("2.25.30853397773651184949181049330553108086").good());
++ OFCHECK(ct->getSeries().setSeriesInstanceUID("1.2.276.0.7230010.3.1.3.8323329.14863.1565940357.864812").good());
++ OFCHECK(ct->getSOPCommon().setSOPInstanceUID("1.2.276.0.7230010.3.1.4.8323329.14863.1565940357.864813").good());
++
++ OFCHECK(ct->getIODMultiFrameFGModule().setContentTime("092557").good());
++ OFCHECK(ct->getIODMultiFrameFGModule().setContentDate("20190816").good());
++}
++
++static void addSharedFGs(EctEnhancedCT *ct)
++{
++ if (!ct)
++ return;
++
++ FGPixelMeasures meas;
++ OFCHECK(meas.setPixelSpacing("0.1\\0.1").good());
++ OFCHECK(meas.setSliceThickness("1.0").good());
++ OFCHECK(meas.setSpacingBetweenSlices("0.05").good());
++
++ FGPlanePosPatient planpo;
++ OFCHECK(planpo.setImagePositionPatient("0.0", "0.0", "0.0").good());
++
++ FGPlaneOrientationPatient planor;
++ OFCHECK(planor.setImageOrientationPatient("1.0", "0.0", "0.0", "0.0", "1.0", "0.0").good());
++
++ FGFrameAnatomy ana;
++ OFCHECK(ana.setLaterality(FGFrameAnatomy::LATERALITY_BOTH).good());
++ OFCHECK(ana.getAnatomy().getAnatomicRegion().set("12738006", "SCT", "Brain").good());
++
++ FGIrradiationEventIdentification irr;
++ OFCHECK(irr.setIrradiationEventUID("2.25.30853892236613436472911970638347155062").good());
++
++ FGCTImageFrameType itype;
++ OFCHECK(itype.setFrameType("ORIGINAL\\PRIMARY\\VOLUME\\MAXIMUM").good());
++ OFCHECK(itype.setPixelPresentation(FGCTImageFrameType::E_PixelPres_Monochrome).good());
++ OFCHECK(itype.setVolumetricProperties(FGCTImageFrameType::E_VolProp_Volume).good());
++ OFCHECK(itype.setVolumeBasedCalculationTechnique(FGCTImageFrameType::DT_VolBasedCalcTechnique_VolumeRender).good());
++
++ FGCTAcquisitionType atype;
++ OFCHECK(atype.setAcquisitionType(FGCTAcquisitionType::DT_AcquisitionType_ConstantAngle).good());
++ OFCHECK(atype.setTubeAngle(0.1).good());
++ OFCHECK(atype.setConstantVolumeFlag(FGCTAcquisitionType::E_ConstVol_Yes).good());
++ OFCHECK(atype.setFluoroscopyFlag(FGCTAcquisitionType::E_Fluoroscopy_No).good());
++
++ FGCTAcquisitionDetails adetails;
++ FGCTAcquisitionDetails::FGCTAcquisitionDetailsItem *item = new FGCTAcquisitionDetails::FGCTAcquisitionDetailsItem();
++ OFCHECK(item->setRotationDirection(FGCTAcquisitionDetails::E_RotationDirection_CW).good());
++ OFCHECK(item->setRevolutionTime(5).good());
++ OFCHECK(item->setSingleCollimationWidth(1).good());
++ OFCHECK(item->setTotalCollimationWidth(10).good());
++ OFCHECK(item->setTableHeight(50).good());
++ OFCHECK(item->setGantryDetectorTilt(5).good());
++ OFCHECK(item->setDataCollectionDiameter(20).good());
++ adetails.getCTAcquisitionDetailsItems().push_back(item);
++
++ FGCTTableDynamics dyn;
++ FGCTTableDynamics::FGCTTableDynamicsItem *dyn_item = new FGCTTableDynamics::FGCTTableDynamicsItem;
++ OFCHECK(dyn_item);
++ if (dyn_item)
++ {
++ OFCHECK(dyn_item->setTableSpeed(1.0).good());
++ OFCHECK(dyn_item->setTableFeedPerRotation(0.1).good());
++ OFCHECK(dyn_item->setSpiralPitchFactor(0.2).good());
++ dyn.getCTTableDynamicsItems().push_back(dyn_item);
++ }
++
++ FGCTPosition pos;
++ OFCHECK(pos.setTablePosition(100.0).good());
++ OFCHECK(pos.setReconstructionTargetCenterPatient(OFVector<Float64>(3, 1.0)).good());
++ OFCHECK(pos.setDataCollectionCenterPatient(OFVector<Float64>(3, 2.0)).good());
++
++ FGCTGeometry geo;
++ FGCTGeometry::FGCTGeometryItem *geo_item = new FGCTGeometry::FGCTGeometryItem;
++ if (geo_item)
++ {
++ OFCHECK(geo_item->setDistanceSourceToDataCollectionCenter(5.0).good());
++ OFCHECK(geo_item->setDistanceSourceToDetector(0.5).good());
++ geo.getCTGeometryItems().push_back(geo_item);
++ }
++
++ FGCTReconstruction rec;
++ OFCHECK(rec.setConvolutionKernel("DUMMY").good());
++ OFCHECK(rec.setConvolutionKernelGroup("DUMMYGROUP").good());
++ OFCHECK(rec.setImageFilter("FILTER").good());
++ OFCHECK(rec.setReconstructionAlgorithm("ALGO").good());
++ OFCHECK(rec.setReconstructionAngle(90.0).good());
++ OFCHECK(rec.setReconstructionDiameter(100.0).good());
++ // Not permitted if Reconstruction Diameter is provided instead
++ // OFCHECK(rec.setReconstructionFieldOfView(100.0, 100.0).good());
++ OFCHECK(rec.setReconstructionPixelSpacing(0.1, 0.1).good());
++
++ FGCTExposure exp;
++ FGCTExposure::FGCTExposureItem *exp_item = new FGCTExposure::FGCTExposureItem;
++ if (exp_item)
++ {
++ OFCHECK(exp_item->setCTDIVol(0.1).good());
++ CodeSequenceMacro *phantom_item = new CodeSequenceMacro("113682", "DCM", "ACR Accreditation Phantom - CT");
++ exp_item->getCTDIPhantomTypeCodeSequence().push_back(phantom_item);
++ OFCHECK(exp_item->setExposureInMas(0.3).good());
++ OFCHECK(exp_item->setExposureModulationType("WEIRD").good());
++ OFCHECK(exp_item->setExposureTimeInMs(0.4).good());
++ OFCHECK(exp_item->setImageAndFluoroscopyAreaDoseProduct(0.5).good());
++ OFCHECK(exp_item->setWaterEquivalentDiameter(0.6).good());
++ CodeSequenceMacro *water_code = new CodeSequenceMacro("113987", "DCM", "AAPM 220");
++ exp_item->getWaterEquivalentDiameterCalculationMethodCodeSequence().push_back(water_code);
++ OFCHECK(exp_item->setXRayTubeCurrentInMa(0.7).good());
++ exp.getCTExposureItems().push_back(exp_item);
++ }
++
++ FGCTXRayDetails det;
++ FGCTXRayDetails::FGCTXRayDetailsItem *det_item = new FGCTXRayDetails::FGCTXRayDetailsItem;
++ if (det_item)
++ {
++ OFCHECK(det_item->setCalciumScoringMassFactorDevice(OFVector<Float32>(3, 1)).good());
++ OFCHECK(det_item->setCalciumScoringMassFactorPatient(2).good());
++ OFCHECK(det_item->setEnergyWeightingFactor(3).good());
++ OFCHECK(det_item->setFilterMaterial("FILTER_MATERIAL").good());
++ OFCHECK(det_item->setFilterType("FILTER_TYPE").good());
++ OFCHECK(det_item->setFocalSpots(OFVector<Float64>(4, 4.4)).good());
++ OFCHECK(det_item->setKVP(5.0).good());
++ det.getCTXRayDetailsItems().push_back(det_item);
++ }
++
++ FGPixelValueTransformation trans;
++ trans.setFGType(FGPixelValueTransformation::E_PixelValTrans_CT);
++ trans.setRescaleIntercept("0");
++ trans.setRescaleSlope("1");
++ trans.setRescaleType("HU");
++
++ FGCTAdditionalXRaySource asrc;
++ FGCTAdditionalXRaySource::FGCTAdditionalXRaySourceItem *asrc_item = new FGCTAdditionalXRaySource::FGCTAdditionalXRaySourceItem;
++ if (asrc_item)
++ {
++ OFCHECK(asrc_item->setDataCollectionDiameter(1.0).good());
++ OFCHECK(asrc_item->setEnergyWeightingFactor(2.0).good());
++ OFCHECK(asrc_item->setExposureInmAs(3.0).good());
++ OFCHECK(asrc_item->setFilterMaterial("FILTER_MATERIAL").good());
++ OFCHECK(asrc_item->setFilterType("FILTER_TYPE").good());
++ OFCHECK(asrc_item->setFocalSpots(OFVector<Float64>(4, 4.4)).good());
++ OFCHECK(asrc_item->setKVP(5).good());
++ OFCHECK(asrc_item->setXRayTubeCurrentInmA(6).good());
++ asrc.getCTAdditionalXRaySourceItems().push_back(asrc_item);
++ }
++
++ OFCHECK(ct->addForAllFrames(meas).good());
++ OFCHECK(ct->addForAllFrames(planpo).good());
++ OFCHECK(ct->addForAllFrames(planor).good());
++ OFCHECK(ct->addForAllFrames(ana).good());
++ OFCHECK(ct->addForAllFrames(irr).good());
++ OFCHECK(ct->addForAllFrames(itype).good());
++ OFCHECK(ct->addForAllFrames(atype).good());
++ OFCHECK(ct->addForAllFrames(adetails).good());
++ OFCHECK(ct->addForAllFrames(dyn).good());
++ OFCHECK(ct->addForAllFrames(pos).good());
++ OFCHECK(ct->addForAllFrames(geo).good());
++ OFCHECK(ct->addForAllFrames(rec).good());
++ OFCHECK(ct->addForAllFrames(exp).good());
++ OFCHECK(ct->addForAllFrames(det).good());
++ OFCHECK(ct->addForAllFrames(trans).good());
++ OFCHECK(ct->addForAllFrames(asrc).good());
++}
++
++static void addFrames(EctEnhancedCT *ct)
++{
++ if (!ct)
++ return;
++
++ FGFrameContent *fg = new FGFrameContent();
++ fg->setStackID("1");
++ OFCHECK(fg);
++ if (fg)
++ {
++ EctEnhancedCT::FramesType frames = ct->getFrames();
++ for (Uint16 frameNo = 1; frameNo <= NUM_FRAMES; frameNo++)
++ {
++ OFCHECK(fg->setFrameAcquisitionNumber(frameNo).good());
++ OFCHECK(fg->setFrameReferenceDateTime("20190816092557").good());
++ OFCHECK(fg->setFrameAcquisitionDateTime("20190816092557").good());
++ OFCHECK(fg->setFrameAcquisitionDuration(0.001).good());
++ OFCHECK(fg->setInStackPositionNumber(frameNo).good());
++ OFCHECK(fg->setDimensionIndexValues(1, 0).good());
++ OFCHECK(fg->setDimensionIndexValues(frameNo, 1).good());
++ OFVector<FGBase *> groups;
++ groups.push_back(fg);
++
++ Uint16 *data = new Uint16[NUM_PIXELS_PER_FRAME];
++ for (size_t i = 0; i < NUM_PIXELS_PER_FRAME; ++i)
++ {
++ data[i] = 0x4141;
++ }
++ OFCHECK(
++ OFget<EctEnhancedCT::Frames<Uint16>>(&frames)->addFrame(data, NUM_PIXELS_PER_FRAME, groups).good());
++ delete[] data;
++ }
++ }
++ delete fg;
++}
++
++static void addDimensions(EctEnhancedCT *ct)
++{
++ if (!ct)
++ return;
++ IODMultiframeDimensionModule &dims = ct->getDimensions();
++ OFCHECK(dims.addDimensionIndex(
++ DCM_StackID, "2.25.30855560781715986879861690673941231222", DCM_FrameContentSequence, "STACK_DIM")
++ .good());
++ OFCHECK(dims.addDimensionIndex(DCM_InStackPositionNumber,
++ "2.25.30855560781715986879861690673941231222",
++ DCM_FrameContentSequence,
++ "STACK_DIM")
++ .good());
++ OFunique_ptr<IODMultiframeDimensionModule::DimensionOrganizationItem> org(
++ new IODMultiframeDimensionModule::DimensionOrganizationItem);
++ if (org)
++ {
++ org->setDimensionOrganizationUID("2.25.30855560781715986879861690673941231222");
++ dims.getDimensionOrganizationSequence().push_back(org.release());
++ }
++}
++
++
+diff --git a/dcmect/tests/tests.cc b/dcmect/tests/tests.cc
+index 54a6ca021..8639dc1ac 100644
+--- a/dcmect/tests/tests.cc
++++ b/dcmect/tests/tests.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2019, OFFIS e.V.
++ * Copyright (C) 2019-2024, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -23,5 +23,6 @@
+ #include "dcmtk/ofstd/oftest.h"
+
+ OFTEST_REGISTER(dcmect_huge_concat);
++OFTEST_REGISTER(dcmect_overflow);
+ OFTEST_REGISTER(dcmect_roundtrip);
+ OFTEST_MAIN("dcmect")
+--
+2.30.2
+
--- /dev/null
+Author: Joerg Riesmeier <dicom@jriesmeier.com>
+Forwarded: https://git.dcmtk.org/?p=dcmtk.git;a=commit;h=89a6e399f1e17d08a8bc8cdaa05b2ac9a50cd4f6
+Bug-Debian: https://bugs.debian.org/1093043
+Reviewed-By: Étienne Mollier <emollier@debian.org>
+Last-Update: 2025-01-18
+Description: Fixed issue rendering invalid monochrome image.
+ Fixed issue when rendering an invalid monochrome DICOM image where the
+ number of pixels stored does not match the expected number of pixels.
+ If the stored number is less than the expected number, the rest of the
+ pixel matrix for the intermediate representation was always filled with
+ the value 0. Under certain, very rare conditions, this could result in
+ memory problems reported by an Address Sanitizer (ASAN). Now, the rest
+ of the matrix is filled with the smallest possible value for the image.
+ .
+ Thanks to Emmanuel Tacheau from the Cisco Talos team
+ <vulndiscovery@external.cisco.com> for the original report, the sample
+ file (PoC) and further details. See TALOS-2024-2122 and CVE-2024-47796.
+
+--- dcmtk.orig/dcmimgle/include/dcmtk/dcmimgle/dimoipxt.h
++++ dcmtk/dcmimgle/include/dcmtk/dcmimgle/dimoipxt.h
+@@ -72,9 +72,9 @@
+ rescale(pixel); // "copy" or reference pixel data
+ this->determineMinMax(OFstatic_cast(T3, this->Modality->getMinValue()), OFstatic_cast(T3, this->Modality->getMaxValue()));
+ }
+- /* erase empty part of the buffer (= blacken the background) */
++ /* erase empty part of the buffer (= fill the background with the smallest possible value) */
+ if ((this->Data != NULL) && (this->InputCount < this->Count))
+- OFBitmanipTemplate<T3>::zeroMem(this->Data + this->InputCount, this->Count - this->InputCount);
++ OFBitmanipTemplate<T3>::setMem(this->Data + this->InputCount, OFstatic_cast(T3, this->Modality->getAbsMinimum()), this->Count - this->InputCount);
+ }
+ }
+
--- /dev/null
+Author: Joerg Riesmeier <dicom@jriesmeier.com>
+Forwarded: https://git.dcmtk.org/?p=dcmtk.git;a=commit;h=03e851b0586d05057c3268988e180ffb426b2e03
+Bug-Debian: https://bugs.debian.org/1093047
+Reviewed-By: Étienne Mollier <emollier@debian.org>
+Last-Update: 2025-01-18
+Description: Added check to make sure: HighBit < BitsAllocated.
+ Added check to the image preprocessing to make sure that the value of
+ HighBit is always less than the value of BitsAllocated. Before, this
+ missing check could lead to memory corruption if an invalid combination
+ of values was retrieved from a malformed DICOM dataset.
+ .
+ Thanks to Emmanuel Tacheau from the Cisco Talos team
+ <vulndiscovery@external.cisco.com> for the report, sample file (PoC)
+ and detailed analysis. See TALOS-2024-2121 and CVE-2024-52333.
+
+--- dcmtk.orig/dcmimgle/libsrc/diimage.cc
++++ dcmtk/dcmimgle/libsrc/diimage.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1996-2021, OFFIS e.V.
++ * Copyright (C) 1996-2025, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -548,12 +548,18 @@
+ {
+ const unsigned long fsize = OFstatic_cast(unsigned long, Rows) * OFstatic_cast(unsigned long, Columns) *
+ OFstatic_cast(unsigned long, SamplesPerPixel);
+- if ((BitsAllocated < 1) || (BitsStored < 1) || (BitsAllocated < BitsStored) ||
+- (BitsStored > OFstatic_cast(Uint16, HighBit + 1)))
++ if ((BitsAllocated < 1) || (BitsStored < 1))
+ {
+ ImageStatus = EIS_InvalidValue;
+- DCMIMGLE_ERROR("invalid values for 'BitsAllocated' (" << BitsAllocated << "), "
+- << "'BitsStored' (" << BitsStored << ") and/or 'HighBit' (" << HighBit << ")");
++ DCMIMGLE_ERROR("invalid value(s) for 'BitsAllocated' (" << BitsAllocated << "), "
++ << "and/or 'BitsStored' (" << BitsStored << ")");
++ return;
++ }
++ else if ((BitsAllocated < BitsStored) || (BitsAllocated <= HighBit) || ((BitsStored - 1) > HighBit))
++ {
++ ImageStatus = EIS_InvalidValue;
++ DCMIMGLE_ERROR("invalid combination of values for 'BitsAllocated' (" << BitsAllocated << "), "
++ << "'BitsStored' (" << BitsStored << ") and 'HighBit' (" << HighBit << ")");
+ return;
+ }
+ else if ((evr == EVR_OB) && (BitsStored <= 8))
--- /dev/null
+Author: Jürgen Salk <jsa@debian.org>
+Description: The original maintainer Jürgen Salk applied
+ a set of patches to the original code. This file contains
+ changes to C++ code
+Forwarded: not-needed
+
+--- a/dcmqrdb/etc/dcmqrscp.cfg
++++ b/dcmqrdb/etc/dcmqrscp.cfg
+@@ -21,8 +21,8 @@
+ # SpecificCharacterSet = "ISO_IR 192", override, discard, transliterate
+
+ #
+-# UserName = <not used>
+-# GroupName = <not used>
++UserName = dcmtk
++GroupName = dcmtk
+
+ HostTable BEGIN
+ #
+@@ -38,12 +38,13 @@
+ # NOTE: in the current implementation you cannot substitute an IP address
+ # for a hostname.
+ #
+-acme1 = (ACME1, acmehost1, 5678)
+-acme2 = (ACME2, acmehost2, 5678)
+-acmeCTcompany = acme1, acme2
+-united1 = (UNITED1, unitedhost1, 104)
+-united2 = (UNITED2, unitedhost2, 104)
+-unitedMRcompany = united1, united2
++# Example:
++#acme1 = (ACME1, acmehost1, 5678)
++#acme2 = (ACME2, acmehost2, 5678)
++#acmeCTcompany = acme1, acme2
++#united1 = (UNITED1, unitedhost1, 104)
++#united2 = (UNITED2, unitedhost2, 104)
++#unitedMRcompany = united1, united2
+ #
+ HostTable END
+
+@@ -61,8 +62,9 @@
+ # VendorName = SymbolicName
+ # The symbolic name should be defined in the HostTable.
+ #
+-"Acme CT Company" = acmeCTcompany
+-"United MR Company" = unitedMRcompany
++# Example:
++#"Acme CT Company" = acmeCTcompany
++#"United MR Company" = unitedMRcompany
+ #
+ VendorTable END
+
+@@ -80,8 +82,13 @@
+ # Entry in HostTable |
+ # ANY
+ #
+-COMMON /home/dicom/db/COMMON R (200, 1024mb) ANY
+-ACME_STORE /home/dicom/db/ACME_STORE RW (9, 1024mb) acmeCTcompany
+-UNITED_STORE /home/dicom/db/UNITED_STORE RW (9, 1024mb) unitedMRcompany
++# Example:
++#
++#ACME_STORE /var/lib/dcmtk/db/ACME_STORE RW (9, 1024mb) acmeCTcompany
++#UNITED_STORE /var/lib/dcmtk/db/UNITED_STORE RW (9, 1024mb) unitedMRcompany
++#
++# Uncomment and adjust the following lines for a common r/rw storage area:
++#READWRITE /var/lib/dcmtk/db/READWRITE RW (10, 1024mb) ANY
++#READ /var/lib/dcmtk/db/READ R (200, 1024mb) ANY
+ #
+ AETable END
+--- a/dcmqrdb/docs/dcmqrcnf.txt
++++ b/dcmqrdb/docs/dcmqrcnf.txt
+@@ -46,8 +46,8 @@
+ MaxPDUSize = 8192
+ MaxAssociations = 20
+ SpecificCharacterSet = fallback
+-UserName = (do not change user)
+-GroupName = (do not change group)
++UserName = dcmtk
++GroupName = dcmtk
+
+ Available options for specific character sets are:
+
--- /dev/null
+Description: Install dict to versioned dir
+Bug-Debian: https://bugs.debian.org/709123
+Forwarded: not-needed
+Author: Mathieu Malaterre <malat@debian.org>
+--- a/CMake/GenerateDCMTKConfigure.cmake
++++ b/CMake/GenerateDCMTKConfigure.cmake
+@@ -118,23 +118,8 @@ endif()
+
+ # Configure file
+
+-# Windows being windows, it lies about its processor type to 32 bit binaries
+-set(SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}")
+-if(NOT SYSTEM_PROCESSOR)
+- if(WIN32 AND NOT CYGWIN)
+- if(CMAKE_GENERATOR_PLATFORM)
+- set(SYSTEM_PROCESSOR "${CMAKE_GENERATOR_PLATFORM}")
+- elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+- set(SYSTEM_PROCESSOR "x64")
+- elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+- set(SYSTEM_PROCESSOR "Win32")
+- endif()
+- else()
+- set(SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
+- endif()
+-endif()
+ # CMake doesn't provide a configure-style system type string
+-set(CANONICAL_HOST_TYPE "${SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}")
++set(CANONICAL_HOST_TYPE "Debian")
+ DCMTK_UNSET(SYSTEM_PROCESSOR)
+
+ # Configure dictionary path and install prefix
+@@ -147,10 +132,10 @@ if(WIN32 AND NOT CYGWIN)
+ set(ENVIRONMENT_PATH_SEPARATOR ";")
+ # Set dictionary path to the data dir inside install main dir (prefix)
+ if(DCMTK_DEFAULT_DICT STREQUAL "external")
+- set(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\dcmtk\\\\dicom.dic")
++ set(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\dicom.dic")
+ # If private dictionary should be utilized, add it to default dictionary path.
+ if(ENABLE_PRIVATE_TAGS)
+- set(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH};${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\dcmtk\\\\private.dic")
++ set(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH};${DCMTK_PREFIX}\\\\${CMAKE_INSTALL_DATADIR}\\\\private.dic")
+ endif()
+ # Again, for Windows strip all / from path and replace it with \\.
+ string(REGEX REPLACE "/" "\\\\\\\\" DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH}")
+@@ -168,10 +153,10 @@ else()
+ set(ENVIRONMENT_PATH_SEPARATOR ":")
+ # Set dictionary path to the data dir inside install main dir (prefix).
+ if(DCMTK_DEFAULT_DICT STREQUAL "external")
+- set(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/dicom.dic")
++ set(DCM_DICT_DEFAULT_PATH "${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIC}/dicom.dic")
+ # If private dictionary should be utilized, add it to default dictionary path.
+ if(ENABLE_PRIVATE_TAGS)
+- set(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH}:${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIR}/dcmtk/private.dic")
++ set(DCM_DICT_DEFAULT_PATH "${DCM_DICT_DEFAULT_PATH}:${DCMTK_PREFIX}/${CMAKE_INSTALL_DATADIC}/private.dic")
+ endif()
+ else()
+ set(DCM_DICT_DEFAULT_PATH "")
+--- a/dcmdata/data/CMakeLists.txt
++++ b/dcmdata/data/CMakeLists.txt
+@@ -1,5 +1,8 @@
+ # declare installation files
+-install(FILES dicom.dic acrnema.dic private.dic diconde.dic dcm2xml.dtd dumppat.txt SC.dump VLP.dump DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data)
++set(DCMTK_INSTALL_DATDIR "share/libdcmtk${DCMTK_ABI_VERSION}")
++
++install(FILES dcm2xml.dtd dumppat.txt SC.dump VLP.dump DESTINATION "${CMAKE_INSTALL_DATADIR}/dcmtk" COMPONENT data)
++install(FILES dicom.dic acrnema.dic private.dic diconde.dic DESTINATION ${CMAKE_INSTALL_DATADIC} COMPONENT data)
+
+ # add paths to the dictionaries to a CMake variable for being used by the unit tests
+ set(DCMTK_DICOM_DICTIONARIES
--- /dev/null
+Description: Don't add executables to cmake exports
+ CMake exports are used by other packages that compile
+ and link against dcmtk. Because Debian moves some of
+ these executables and also dosn't install the test
+ executables, this import may fail leading to failure
+ to configure the according package.
+Bug-Debian: https://bugs.debian.org/803304
+Author: Gert Wollny <gw.fossdev@gmail.com>
+Forwarded: not-needed
+Index: dcmtk/CMake/dcmtkMacros.cmake
+===================================================================
+--- dcmtk.orig/CMake/dcmtkMacros.cmake
++++ dcmtk/CMake/dcmtkMacros.cmake
+@@ -55,11 +55,11 @@ macro(DCMTK_ADD_EXECUTABLE PROGRAM)
+ endif()
+
+ # Collect executable as part of global DCMTK_EXECUTABLE_TARGETS property
+- set_property(GLOBAL APPEND PROPERTY DCMTK_EXECUTABLE_TARGETS ${PROGRAM})
++ #set_property(GLOBAL APPEND PROPERTY DCMTK_EXECUTABLE_TARGETS ${PROGRAM})
+
+ # declare installation files, also export DCMTKTargets.cmake
+ install(TARGETS ${PROGRAM}
+- EXPORT DCMTKTargets
++ # EXPORT DCMTKTargets
+ COMPONENT bin
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
--- /dev/null
+From 0cf6b12d8ea0b727f0fe2ab076b6f180100fbd30 Mon Sep 17 00:00:00 2001
+From: Michael Onken <onken@open-connections.de>
+Date: Thu, 25 Nov 2021 11:59:16 +0100
+Subject: [PATCH] Remove some typos in the codebase.
+
+ * Concatentation -> Concatenation
+ * intialized -> initialized
+ * "permits to" -> "permits one to"
+ * "allow to" -> "allow one to"
+ * "allows to" -> "allows one to"
+ * truely -> truly
+ * additonal -> additional
+
+Thanks to GitHub user "malaterre" for the report and suggested fix.
+---
+ dcmfg/libsrc/concatenationcreator.cc | 2 +-
+ dcmfg/libsrc/concatenationloader.cc | 6 +++---
+ dcmfg/tests/t_concatenation_loader.cc | 12 ++++++------
+ dcmjpeg/docs/dcmcjpeg.man | 2 +-
+ dcmpstat/apps/dcmpsmk.cc | 2 +-
+ dcmpstat/docs/dcmp2pgm.man | 2 +-
+ dcmpstat/docs/dcmprscp.man | 2 +-
+ dcmpstat/docs/dcmpsmk.man | 2 +-
+ dcmwlm/docs/wlmscpfs.man | 2 +-
+ 9 files changed, 16 insertions(+), 16 deletions(-)
+
+Index: dcmtk/dcmfg/libsrc/concatenationcreator.cc
+===================================================================
+--- dcmtk.orig/dcmfg/libsrc/concatenationcreator.cc
++++ dcmtk/dcmfg/libsrc/concatenationcreator.cc
+@@ -246,7 +246,7 @@ size_t ConcatenationCreator::getNumInsta
+ OFCondition result = configureCommon();
+ if (result.bad())
+ {
+- DCMFG_ERROR("Unable to compute number of instances for Concatenation, maybe input not intialized?)");
++ DCMFG_ERROR("Unable to compute number of instances for Concatenation, maybe input not initialized?)");
+ return 0;
+ }
+ }
+Index: dcmtk/dcmfg/libsrc/concatenationloader.cc
+===================================================================
+--- dcmtk.orig/dcmfg/libsrc/concatenationloader.cc
++++ dcmtk/dcmfg/libsrc/concatenationloader.cc
+@@ -445,7 +445,7 @@ OFCondition ConcatenationLoader::insertD
+ char buf[100];
+ dcmGenerateUniqueIdentifier(buf, SITE_INSTANCE_UID_ROOT);
+ uid = buf;
+- DCMFG_WARN("SOP Instance UID of Concatentation Source (0020,0242) not set, created new SOP Instance UID "
++ DCMFG_WARN("SOP Instance UID of Concatenation Source (0020,0242) not set, created new SOP Instance UID "
+ << uid);
+ }
+ OFCondition result = m_Result->putAndInsertOFStringArray(DCM_SOPInstanceUID, uid);
+@@ -551,8 +551,8 @@ void ConcatenationLoader::Info::print(OF
+ {
+ out << "Concatenation UID* : " << m_ConcatenationUID << OFendl;
+ out << " SOP Class UID* : " << m_SOPClassUID << OFendl;
+- out << " Concatentation Source UID* : " << m_SourceUID << OFendl;
+- out << " Concatentation Source File : " << m_FileConatenationSource << OFendl;
++ out << " Concatenation Source UID* : " << m_SourceUID << OFendl;
++ out << " Concatenation Source File : " << m_FileConatenationSource << OFendl;
+ out << " Number of Frames (computed): " << m_NumTotalFrames << OFendl;
+ out << " In-conc. Total Number : " << m_inConcatTotalNumber << OFendl;
+ out << " Patient ID : " << m_PatientID << OFendl;
+Index: dcmtk/dcmfg/tests/t_concatenation_loader.cc
+===================================================================
+--- dcmtk.orig/dcmfg/tests/t_concatenation_loader.cc
++++ dcmtk/dcmfg/tests/t_concatenation_loader.cc
+@@ -114,8 +114,8 @@ static void prepare_scan_dump()
+ {
+ SCAN_DUMP += "Concatenation UID* : 1.3.6.1.4.1.5962.1.7.70.2.1.1166562673.14401\n";
+ SCAN_DUMP += " SOP Class UID* : 1.2.840.10008.5.1.4.1.1.2.1\n";
+- SCAN_DUMP += " Concatentation Source UID* : \n";
+- SCAN_DUMP += " Concatentation Source File : \n";
++ SCAN_DUMP += " Concatenation Source UID* : \n";
++ SCAN_DUMP += " Concatenation Source File : \n";
+ SCAN_DUMP += " Number of Frames (computed): 60\n";
+ SCAN_DUMP += " In-conc. Total Number : 6\n";
+ SCAN_DUMP += " Patient ID : 0070\n";
+@@ -152,8 +152,8 @@ static void prepare_scan_dump()
+ SCAN_DUMP += "--------------------------------------------------------------\n";
+ SCAN_DUMP += "Concatenation UID* : 1.3.6.1.4.1.5962.1.7.70.2.2.1166562673.14401\n";
+ SCAN_DUMP += " SOP Class UID* : 1.2.840.10008.5.1.4.1.1.2.1\n";
+- SCAN_DUMP += " Concatentation Source UID* : \n";
+- SCAN_DUMP += " Concatentation Source File : \n";
++ SCAN_DUMP += " Concatenation Source UID* : \n";
++ SCAN_DUMP += " Concatenation Source File : \n";
+ SCAN_DUMP += " Number of Frames (computed): 30\n";
+ SCAN_DUMP += " In-conc. Total Number : 3\n";
+ SCAN_DUMP += " Patient ID : 0070\n";
+@@ -178,8 +178,8 @@ static void prepare_scan_dump()
+ SCAN_DUMP += "--------------------------------------------------------------\n";
+ SCAN_DUMP += "Concatenation UID* : 1.3.6.1.4.1.5962.1.7.70.2.3.1166562673.14401\n";
+ SCAN_DUMP += " SOP Class UID* : 1.2.840.10008.5.1.4.1.1.2.1\n";
+- SCAN_DUMP += " Concatentation Source UID* : \n";
+- SCAN_DUMP += " Concatentation Source File : \n";
++ SCAN_DUMP += " Concatenation Source UID* : \n";
++ SCAN_DUMP += " Concatenation Source File : \n";
+ SCAN_DUMP += " Number of Frames (computed): 30\n";
+ SCAN_DUMP += " In-conc. Total Number : 3\n";
+ SCAN_DUMP += " Patient ID : 0070\n";
+Index: dcmtk/dcmjpeg/docs/dcmcjpeg.man
+===================================================================
+--- dcmtk.orig/dcmjpeg/docs/dcmcjpeg.man
++++ dcmtk/dcmjpeg/docs/dcmcjpeg.man
+@@ -148,7 +148,7 @@ lossless JPEG codec selection:
+ +tl --true-lossless
+ true lossless codec (default)
+
+- # This option selects an encoder, that guarantees truely lossless
++ # This option selects an encoder, that guarantees truly lossless
+ # image compression. See NOTES for further information.
+
+ +pl --pseudo-lossless
+Index: dcmtk/dcmpstat/apps/dcmpsmk.cc
+===================================================================
+--- dcmtk.orig/dcmpstat/apps/dcmpsmk.cc
++++ dcmtk/dcmpstat/apps/dcmpsmk.cc
+@@ -311,7 +311,7 @@ int main(int argc, char *argv[])
+ /* add additional image references to pstate */
+ if (cmd.getParamCount() > 2)
+ {
+- OFLOG_INFO(dcmpsmkLogger, "adding additonal image reference(s)");
++ OFLOG_INFO(dcmpsmkLogger, "adding additional image reference(s)");
+ const int count = cmd.getParamCount();
+ for (int i = 2; i < count; i++)
+ {
+Index: dcmtk/dcmpstat/docs/dcmp2pgm.man
+===================================================================
+--- dcmtk.orig/dcmpstat/docs/dcmp2pgm.man
++++ dcmtk/dcmpstat/docs/dcmp2pgm.man
+@@ -19,7 +19,7 @@ a grayscale softcopy presentation state
+ with 8 bits/pixel. The bitmap is stored either as "Portable Gray Map" (PGM)
+ or as a DICOM secondary capture image object. If no presentation state is
+ read from file, a default presentation state is created. The utility allows
+-to read a configuration file of the Softcopy Presentation State Viewer upon
++one to read a configuration file of the Softcopy Presentation State Viewer upon
+ startup. In this case, the settings from the configuration file affecting
+ the rendering of the presentation state are used, e.g. a correction of the
+ gray scale range according to Barten's model (DICOM part 14) can be
+Index: dcmtk/dcmpstat/docs/dcmprscp.man
+===================================================================
+--- dcmtk.orig/dcmpstat/docs/dcmprscp.man
++++ dcmtk/dcmpstat/docs/dcmprscp.man
+@@ -22,7 +22,7 @@ The \b dcmprscp utility accepts print jo
+ not create real hardcopies but stores print jobs in the local DICOMscope
+ database as a set of Stored Print objects (one per page) and Hardcopy
+ Grayscale images (one per film box N-SET). The DICOMscope application allows
+-to load a Stored Print object created by \b dcmprscp and to render a screen
++one to load a Stored Print object created by \b dcmprscp and to render a screen
+ preview of the hardcopy. The \b dcmprscp utility reads the characteristics of
+ the printer to be emulated from the configuration file.
+
+Index: dcmtk/dcmpstat/docs/dcmpsmk.man
+===================================================================
+--- dcmtk.orig/dcmpstat/docs/dcmpsmk.man
++++ dcmtk/dcmpstat/docs/dcmpsmk.man
+@@ -17,7 +17,7 @@ dcmpsmk [options] dcmfile-in dcmfile-out
+ The \b dcmpsmk utility reads a DICOM image file and creates a grayscale
+ softcopy presentation state object according to Supplement 33. The
+ presentation state object is written back to file. A number of command line
+-options allow to specify how certain constructs that might be present in
++options allow one to specify how certain constructs that might be present in
+ the image file should be referenced or activated in the presentation state.
+ The newly created presentation state references the source image and
+ contains values that should allow for a "reasonable" display of the image
+Index: dcmtk/dcmwlm/docs/wlmscpfs.man
+===================================================================
+--- dcmtk.orig/dcmwlm/docs/wlmscpfs.man
++++ dcmtk/dcmwlm/docs/wlmscpfs.man
+@@ -263,7 +263,7 @@ within the given directory. By default,
+ This should work as a default for most applications that would like to use
+ request files and want to ensure unique file names. If it is desired to change
+ this naming scheme, the option \e --request-file-format can be used. It
+-permits to specify the file naming pattern used by \e --request-file-path.
++permits one to specify the file naming pattern used by \e --request-file-path.
+
+ For flexibility, the following placeholders can be used in the pattern provided
+ for \e --request-file-format:
--- /dev/null
+From 1c8cca4bf6f7c92fc16f9e66faf49409c891a2b0 Mon Sep 17 00:00:00 2001
+From: Marco Eichelberg <dicom@offis.de>
+Date: Fri, 5 Feb 2021 17:50:44 +0100
+Subject: [PATCH] Adjusted the number of digits printed for FL and FD.
+
+Adjusted the number of digits printed for FL elements to FLT_DECIMAL_DIG
+(9) instead of 8, to make sure that the printed values can be converted
+back to FL without loss. Fixed comment for FD, where the values was
+already correct.
+
+Thanks to Mathieu Malaterre <mathieu.malaterre@gmail.com> for pointing
+out the issue.
+---
+ dcmdata/libsrc/dcvrfd.cc | 8 ++++----
+ dcmdata/libsrc/dcvrfl.cc | 8 ++++----
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/dcmdata/libsrc/dcvrfd.cc b/dcmdata/libsrc/dcvrfd.cc
+index 72d9dd5f8..3fabe0a7f 100644
+--- a/dcmdata/libsrc/dcvrfd.cc
++++ b/dcmdata/libsrc/dcvrfd.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2020, OFFIS e.V.
++ * Copyright (C) 1994-2021, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -190,11 +190,11 @@ void DcmFloatingPointDouble::print(STD_NAMESPACE ostream &out,
+ {
+ /* check whether first value is printed (omit delimiter) */
+ if (i == 0)
+- OFStandard::ftoa(buffer, sizeof(buffer), *doubleVals, 0, 0, 17 /* DBL_DIG + 2 for DICOM FD */);
++ OFStandard::ftoa(buffer, sizeof(buffer), *doubleVals, 0, 0, 17 /* DBL_DECIMAL_DIG for DICOM FD */);
+ else
+ {
+ buffer[0] = '\\';
+- OFStandard::ftoa(buffer + 1, sizeof(buffer) - 1, *doubleVals, 0, 0, 17 /* DBL_DIG + 2 for DICOM FD */);
++ OFStandard::ftoa(buffer + 1, sizeof(buffer) - 1, *doubleVals, 0, 0, 17 /* DBL_DECIMAL_DIG for DICOM FD */);
+ }
+ /* check whether current value sticks to the length limit */
+ newLength = printedLength + OFstatic_cast(unsigned long, strlen(buffer));
+@@ -273,7 +273,7 @@ OFCondition DcmFloatingPointDouble::getOFString(OFString &stringVal,
+ {
+ /* ... and convert it to a character string */
+ char buffer[64];
+- OFStandard::ftoa(buffer, sizeof(buffer), doubleVal, 0, 0, 17 /* DBL_DIG + 2 for DICOM FD */);
++ OFStandard::ftoa(buffer, sizeof(buffer), doubleVal, 0, 0, 17 /* DBL_DECIMAL_DIG for DICOM FD */);
+ /* assign result */
+ stringVal = buffer;
+ }
+diff --git a/dcmdata/libsrc/dcvrfl.cc b/dcmdata/libsrc/dcvrfl.cc
+index 5eb83fafc..0934af4f1 100644
+--- a/dcmdata/libsrc/dcvrfl.cc
++++ b/dcmdata/libsrc/dcvrfl.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2020, OFFIS e.V.
++ * Copyright (C) 1994-2021, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -192,11 +192,11 @@ void DcmFloatingPointSingle::print(STD_NAMESPACE ostream &out,
+ {
+ /* check whether first value is printed (omit delimiter) */
+ if (i == 0)
+- OFStandard::ftoa(buffer, sizeof(buffer), *floatVals, 0, 0, 8 /* FLT_DIG + 2 for DICOM FL */);
++ OFStandard::ftoa(buffer, sizeof(buffer), *floatVals, 0, 0, 9 /* FLT_DECIMAL_DIG for DICOM FL */);
+ else
+ {
+ buffer[0] = '\\';
+- OFStandard::ftoa(buffer + 1, sizeof(buffer) - 1, *floatVals, 0, 0, 8 /* FLT_DIG + 2 for DICOM FL */);
++ OFStandard::ftoa(buffer + 1, sizeof(buffer) - 1, *floatVals, 0, 0, 9 /* FLT_DECIMAL_DIG for DICOM FL */);
+ }
+ /* check whether current value sticks to the length limit */
+ newLength = printedLength + OFstatic_cast(unsigned long, strlen(buffer));
+@@ -275,7 +275,7 @@ OFCondition DcmFloatingPointSingle::getOFString(OFString &value,
+ {
+ /* ... and convert it to a character string */
+ char buffer[64];
+- OFStandard::ftoa(buffer, sizeof(buffer), floatVal, 0, 0, 8 /* FLT_DIG + 2 for DICOM FL */);
++ OFStandard::ftoa(buffer, sizeof(buffer), floatVal, 0, 0, 9 /* FLT_DECIMAL_DIG for DICOM FL */);
+ /* assign result */
+ value = buffer;
+ }
+--
+2.30.2
+
--- /dev/null
+From 3ae202ee9d8f27054ad0c463a6799d8b10b4864b Mon Sep 17 00:00:00 2001
+From: Joerg Riesmeier <dicom@jriesmeier.com>
+Date: Thu, 30 Sep 2021 13:48:42 +0200
+Subject: [PATCH] Converted non-ASCII characters to ASCII.
+
+Thanks to GitHub user "malaterre" for the report and suggested fix.
+---
+ dcmect/libsrc/enhanced_ct.cc | 4 ++--
+ dcmfg/libsrc/concatenationloader.cc | 4 ++--
+ dcmiod/include/dcmtk/dcmiod/modsopcommon.h | 6 +++---
+ dcmseg/include/dcmtk/dcmseg/segment.h | 6 +++---
+ dcmtls/include/dcmtk/dcmtls/tlsciphr.h | 6 +++---
+ 5 files changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/dcmect/libsrc/enhanced_ct.cc b/dcmect/libsrc/enhanced_ct.cc
+index 007cb8813..619374290 100644
+--- a/dcmect/libsrc/enhanced_ct.cc
++++ b/dcmect/libsrc/enhanced_ct.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2019, Open Connections GmbH
++ * Copyright (C) 2019-2021, Open Connections GmbH
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation are maintained by
+@@ -480,7 +480,7 @@ OFCondition EctEnhancedCT::loadDataset(DcmDataset& dataset, EctEnhancedCT*& ct)
+ else
+ {
+ DCMECT_ERROR("Invalid SOP Class: "
+- << sopClass << ", only Enhanced CT Image Storage (1.2.840.10008.5.1.4.1.1.2.1) supported");
++ << sopClass << ", only Enhanced CT Image Storage (1.2.840.10008.5.1.4.1.1.2.1) supported");
+ return ECT_InvalidSOPClass;
+ }
+ }
+diff --git a/dcmfg/libsrc/concatenationloader.cc b/dcmfg/libsrc/concatenationloader.cc
+index 3833ddc4f..aad76f69f 100644
+--- a/dcmfg/libsrc/concatenationloader.cc
++++ b/dcmfg/libsrc/concatenationloader.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2019-2020, Open Connections GmbH
++ * Copyright (C) 2019-2021, Open Connections GmbH
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation are maintained by
+@@ -445,7 +445,7 @@ OFCondition ConcatenationLoader::insertDestinationAttributes()
+ char buf[100];
+ dcmGenerateUniqueIdentifier(buf, SITE_INSTANCE_UID_ROOT);
+ uid = buf;
+- DCMFG_WARN("SOP Instance UID of Concatentation Source (0020,0242) not set, created new SOP Instance UID "
++ DCMFG_WARN("SOP Instance UID of Concatentation Source (0020,0242) not set, created new SOP Instance UID "
+ << uid);
+ }
+ OFCondition result = m_Result->putAndInsertOFStringArray(DCM_SOPInstanceUID, uid);
+diff --git a/dcmiod/include/dcmtk/dcmiod/modsopcommon.h b/dcmiod/include/dcmtk/dcmiod/modsopcommon.h
+index fab033e3f..27f433ad2 100644
+--- a/dcmiod/include/dcmtk/dcmiod/modsopcommon.h
++++ b/dcmiod/include/dcmtk/dcmiod/modsopcommon.h
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2015-2019, Open Connections GmbH
++ * Copyright (C) 2015-2021, Open Connections GmbH
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation are maintained by
+@@ -177,8 +177,8 @@ public:
+
+ /** Set Timezone Offset From UTC
+ * @param value Value to be set (single value only) or "" for no value.
+- * Encoded as an ASCII string in the format “&ZZXX”. The components of this
+- * string, from left to right, are & = “+” or “-”, and ZZ = Hours and
++ * Encoded as an ASCII string in the format "&ZZXX". The components of this
++ * string, from left to right, are & = "+" or "-", and ZZ = Hours and
+ * XX = Minutes of offset.
+ * @param checkValue Check 'value' for conformance with VR (SH) and VM (1) if enabled
+ * @return EC_Normal if successful, an error code otherwise
+diff --git a/dcmseg/include/dcmtk/dcmseg/segment.h b/dcmseg/include/dcmtk/dcmseg/segment.h
+index f7987c0c9..8c887a531 100644
+--- a/dcmseg/include/dcmtk/dcmseg/segment.h
++++ b/dcmseg/include/dcmtk/dcmseg/segment.h
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2015-2019, Open Connections GmbH
++ * Copyright (C) 2015-2021, Open Connections GmbH
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation are maintained by
+@@ -58,10 +58,10 @@ public:
+ * successful; memory is allocated by the function
+ * @param segmentLabel Free text label for the segment
+ * @param segmentedPropertyCategory The segmented property category.
+- * Baseline CID 7150 “Segmentation Property Categories” should be
++ * Baseline CID 7150 "Segmentation Property Categories" should be
+ * used.
+ * @param segmentedPropertyType The segmented property type. Baseline CID
+- * 7151 “Segmentation Property Types”
++ * 7151 "Segmentation Property Types"
+ * @param algoType The algorithm type used for segmenting this segment
+ * @param algoName Algorithm name (required if algoType is not MANUAL)
+ * @return EC_Normal if creation was successful, error otherwise
+diff --git a/dcmtls/include/dcmtk/dcmtls/tlsciphr.h b/dcmtls/include/dcmtk/dcmtls/tlsciphr.h
+index 6ffd4a962..c3ad28794 100644
+--- a/dcmtls/include/dcmtk/dcmtls/tlsciphr.h
++++ b/dcmtls/include/dcmtk/dcmtls/tlsciphr.h
+@@ -132,7 +132,7 @@ enum DcmTLSCipherKeyExchange
+ /// Static RSA key exchange
+ TKE_RSA,
+
+- /// Elliptic Curve Diffie–Hellman
++ /// Elliptic Curve Diffie-Hellman
+ TKE_ECDH,
+
+ /// Fixed ECDH with ECDSA-signed certificates
+@@ -141,7 +141,7 @@ enum DcmTLSCipherKeyExchange
+ /// Fixed ECDH with RSA signatures
+ TKE_ECDH_RSA,
+
+- /// Diffie–Hellman key exchange
++ /// Diffie-Hellman key exchange
+ TKE_DH
+
+ };
+@@ -157,7 +157,7 @@ enum DcmTLSCipherAuthentication
+ /// Digital Signature Standard
+ TCA_DSS,
+
+- /// Elliptic Curve Diffie–Hellman
++ /// Elliptic Curve Diffie-Hellman
+ TCA_ECDH,
+
+ /// Elliptic Curve Digital Signature Algorithm
+--
+2.30.2
+
--- /dev/null
+From ab61e8577ff0974efcfae2907c48baf6023c1160 Mon Sep 17 00:00:00 2001
+From: Joerg Riesmeier <dicom@jriesmeier.com>
+Date: Thu, 30 Sep 2021 13:08:23 +0200
+Subject: [PATCH] Replaced German umlaut by its transliteration.
+
+Replaced German umlaut in code meaning by its transliteration.
+
+Thanks to GitHub user "malaterre" for the report.
+---
+ dcmsr/include/dcmtk/dcmsr/codes/dcm.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: dcmtk/dcmsr/include/dcmtk/dcmsr/codes/dcm.h
+===================================================================
+--- dcmtk.orig/dcmsr/include/dcmtk/dcmsr/codes/dcm.h
++++ dcmtk/dcmsr/include/dcmtk/dcmsr/codes/dcm.h
+@@ -1630,7 +1630,7 @@
+ #define CODE_DCM_Generic3DPlanning DSRBasicCodedEntry("112341", "DCM", "Generic 3D Planning")
+ #define CODE_DCM_GenericPlanningForHipReplacement DSRBasicCodedEntry("112342", "DCM", "Generic Planning for Hip Replacement")
+ #define CODE_DCM_GenericPlanningForKneeReplacement DSRBasicCodedEntry("112343", "DCM", "Generic Planning for Knee Replacement")
+-#define CODE_DCM_MuellerMethodPlanningForHipReplacement DSRBasicCodedEntry("112344", "DCM", "Müller Method Planning for Hip Replacement")
++#define CODE_DCM_MuellerMethodPlanningForHipReplacement DSRBasicCodedEntry("112344", "DCM", "Mueller Method Planning for Hip Replacement")
+ #define CODE_DCM_ImplantationPlan DSRBasicCodedEntry("112345", "DCM", "Implantation Plan")
+ #define CODE_DCM_SelectedImplantComponent DSRBasicCodedEntry("112346", "DCM", "Selected Implant Component")
+ #define CODE_DCM_ComponentID DSRBasicCodedEntry("112347", "DCM", "Component ID")
--- /dev/null
+Author: Mathieu Malaterre <malat@debian.org>
+Description: Fix unit test suite on big endian machine
+ Concatenation of upstream commits:
+ .
+ - b499d89e769feffce03c5d7cefa1cb06d33a2b5b
+ - 9e8434a2952ae39d1f9d0914173b5cc5b1b32175
+ - 4df0f42790b9952aa75c7242fbcc47a348922bc6
+Forwarded: not-needed
+
+Index: dcmtk/dcmect/tests/t_roundtrip.cc
+===================================================================
+--- dcmtk.orig/dcmect/tests/t_roundtrip.cc
++++ dcmtk/dcmect/tests/t_roundtrip.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2019-2020, OFFIS e.V.
++ * Copyright (C) 2019-2021, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -28,6 +28,9 @@
+
+ #include "dcmtk/dcmect/enhanced_ct.h"
+
++#include "dcmtk/dcmdata/dcxfer.h"
++#include "dcmtk/dcmdata/dcswap.h"
++
+ #include "dcmtk/dcmfg/concatenationcreator.h"
+ #include "dcmtk/dcmfg/concatenationloader.h"
+ #include "dcmtk/dcmfg/fgctacquisitiondetails.h"
+@@ -295,7 +298,6 @@ static void addSharedFGs(EctEnhancedCT*
+ OFCHECK(exp_item->setCTDIVol(0.1).good());
+ CodeSequenceMacro* phantom_item = new CodeSequenceMacro("113682", "DCM", "ACR Accreditation Phantom - CT");
+ exp_item->getCTDIPhantomTypeCodeSequence().push_back(phantom_item);
+- OFCHECK(exp_item->setEstimatedDoseSaving(0.2).good());
+ OFCHECK(exp_item->setExposureInMas(0.3).good());
+ OFCHECK(exp_item->setExposureModulationType("WEIRD").good());
+ OFCHECK(exp_item->setExposureTimeInMs(0.4).good());
+@@ -619,6 +621,7 @@ static void checkConcatenationInstance(s
+ // Check that all pixels are set to their original source instances frame number (starting from 1)
+ for (size_t pix = 0; pix < NUM_PIXELS_PER_FRAME; pix++)
+ {
++ swapIfNecessary(gLocalByteOrder, EBO_LittleEndian, &frame[pix], 2, sizeof(Uint16));
+ OFCHECK(frame[pix] == numInstance + 1);
+ }
+ delete concat;
+@@ -658,7 +661,11 @@ static void prepareExpectedDump()
+ {
+ EXPECTED_DUMP += "\n";
+ EXPECTED_DUMP += "# Dicom-Data-Set\n";
+- EXPECTED_DUMP += "# Used TransferSyntax: Little Endian Explicit\n";
++ // DcmDataset.print() produces dumps in local endianess, so make sure the dump reflects the current machine
++ if (gLocalByteOrder == EBO_LittleEndian)
++ EXPECTED_DUMP += "# Used TransferSyntax: Little Endian Explicit\n";
++ else
++ EXPECTED_DUMP += "# Used TransferSyntax: Big Endian Explicit\n";
+ EXPECTED_DUMP += "(0008,0008) CS [ORIGINAL\\PRIMARY\\VOLUME\\MAXIMUM] # 32, 4 ImageType\n";
+ EXPECTED_DUMP += "(0008,0016) UI =EnhancedCTImageStorage # 28, 1 SOPClassUID\n";
+ EXPECTED_DUMP
+@@ -789,7 +796,7 @@ static void prepareExpectedDump()
+ EXPECTED_DUMP += " (fffe,e00d) na (ItemDelimitationItem for re-encoding) # 0, 0 ItemDelimitationItem\n";
+ EXPECTED_DUMP += " (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) # 0, 0 SequenceDelimitationItem\n";
+ EXPECTED_DUMP += " (0018,9321) SQ (Sequence with explicit length #=1) # 0, 1 CTExposureSequence\n";
+- EXPECTED_DUMP += " (fffe,e000) na (Item with explicit length #=10) # 0, 1 Item\n";
++ EXPECTED_DUMP += " (fffe,e000) na (Item with explicit length #=9) # 0, 1 Item\n";
+ EXPECTED_DUMP += " (0018,115e) DS [0.5] # 4, 1 "
+ "ImageAndFluoroscopyAreaDoseProduct\n";
+ EXPECTED_DUMP
+@@ -807,7 +814,6 @@ static void prepareExpectedDump()
+ += " (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) # 0, 0 SequenceDelimitationItem\n";
+ EXPECTED_DUMP
+ += " (0018,9323) CS [WEIRD] # 6, 1 ExposureModulationType\n";
+- EXPECTED_DUMP += " (0018,9324) FD 0.2 # 8, 1 EstimatedDoseSaving\n";
+ EXPECTED_DUMP += " (0018,9328) FD 0.4 # 8, 1 ExposureTimeInms\n";
+ EXPECTED_DUMP += " (0018,9330) FD 0.7 # 8, 1 XRayTubeCurrentInmA\n";
+ EXPECTED_DUMP += " (0018,9332) FD 0.3 # 8, 1 ExposureInmAs\n";
+Index: dcmtk/dcmseg/tests/troundtrip.cc
+===================================================================
+--- dcmtk.orig/dcmseg/tests/troundtrip.cc
++++ dcmtk/dcmseg/tests/troundtrip.cc
+@@ -31,6 +31,7 @@
+ #include "dcmtk/dcmfg/fgplanpo.h"
+ #include "dcmtk/dcmfg/fgseg.h"
+ #include "dcmtk/dcmiod/iodmacro.h"
++#include "dcmtk/dcmdata/dcxfer.h"
+ #include "dcmtk/ofstd/ofmem.h"
+ #include "dcmtk/ofstd/ofstrutl.h"
+ #include "dcmtk/ofstd/oftempf.h"
+@@ -406,7 +407,11 @@ static void prepareExpectedDump()
+ {
+ EXPECTED_DUMP = "\n";
+ EXPECTED_DUMP += "# Dicom-Data-Set\n";
+- EXPECTED_DUMP += "# Used TransferSyntax: Little Endian Explicit\n";
++ // DcmDataset.print() produces dumps in local endianess, so make sure the dump reflects the current machine
++ if (gLocalByteOrder == EBO_LittleEndian)
++ EXPECTED_DUMP += "# Used TransferSyntax: Little Endian Explicit\n";
++ else
++ EXPECTED_DUMP += "# Used TransferSyntax: Big Endian Explicit\n";
+ EXPECTED_DUMP += "(0008,0008) CS [DERIVED\\PRIMARY] # 16, 2 ImageType\n";
+ EXPECTED_DUMP += "(0008,0016) UI =SegmentationStorage # 28, 1 SOPClassUID\n";
+ EXPECTED_DUMP
--- /dev/null
+From 8f6c9ba05eb146310a6325fb8ab18dfb14c1a291 Mon Sep 17 00:00:00 2001
+From: Joerg Riesmeier <dicom@jriesmeier.com>
+Date: Mon, 22 Nov 2021 18:54:35 +0100
+Subject: [PATCH] Replaced OFListIterator by OFListConstIterator.
+
+Replaced type of iterator variable to OFListConstIterator to avoid
+compiler errors reported by gcc when compiling DICOMscope with STL
+and C++14 support enabled.
+
+Thanks to GitHub user "malaterre" for the report and suggested fix.
+---
+ dcmsr/include/dcmtk/dcmsr/dsrtlist.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/dcmsr/include/dcmtk/dcmsr/dsrtlist.h b/dcmsr/include/dcmtk/dcmsr/dsrtlist.h
+index 5ec109aca..31759b851 100644
+--- a/dcmsr/include/dcmtk/dcmsr/dsrtlist.h
++++ b/dcmsr/include/dcmtk/dcmsr/dsrtlist.h
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2000-2018, OFFIS e.V.
++ * Copyright (C) 2000-2021, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -282,7 +282,7 @@ template<class T> class DSRListOfItems
+ ItemList.push_back(item);
+ result = EC_Normal;
+ } else {
+- OFLIST_TYPENAME OFListIterator(T) iterator = ItemList.begin();
++ OFLIST_TYPENAME OFListConstIterator(T) iterator = ItemList.begin();
+ if (gotoItemPos(idx, iterator))
+ {
+ ItemList.insert(iterator, 1, item);
+@@ -299,7 +299,7 @@ template<class T> class DSRListOfItems
+ OFCondition removeItem(const size_t idx)
+ {
+ OFCondition result = EC_IllegalParameter;
+- OFLIST_TYPENAME OFListIterator(T) iterator = ItemList.begin();
++ OFLIST_TYPENAME OFListConstIterator(T) iterator = ItemList.begin();
+ if (gotoItemPos(idx, iterator))
+ {
+ ItemList.erase(iterator);
--- /dev/null
+From da5370947226783ce3548bf1e5b7112fac70de46 Mon Sep 17 00:00:00 2001
+From: Joerg Riesmeier <dicom@jriesmeier.com>
+Date: Wed, 8 Nov 2023 11:38:54 +0100
+Subject: [PATCH] Fixed issue with delimiters being converted.
+
+Fixed issue with delimiter character "\" being converted when converting
+a DICOM dataset that uses a Specific Character Set of "ISO 2022 IR 13\ISO
+2022 IR 87" to UTF-8. The delimiter "\" was incorrectly converted to the
+Yen sign when processing the value of an "LO" data element that contains
+multiple values but does not use any escape sequences. This issues has
+been fixed now by always treating the delimiters in a special way.
+
+Thanks to Mathieu Malaterre <mathieu.malaterre@gmail.com> for the report
+and David Gobbi <david.gobbi@gmail.com> for the analysis and testing.
+---
+ dcmdata/libsrc/dcspchrs.cc | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/dcmdata/libsrc/dcspchrs.cc b/dcmdata/libsrc/dcspchrs.cc
+index c327a1aa8..69d14a160 100644
+--- a/dcmdata/libsrc/dcspchrs.cc
++++ b/dcmdata/libsrc/dcspchrs.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2011-2022, OFFIS e.V.
++ * Copyright (C) 2011-2023, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -548,8 +548,9 @@ OFCondition DcmSpecificCharacterSet::convertString(const char *fromString,
+ const OFString &delimiters)
+ {
+ OFCondition status = EC_Normal;
+- // check whether there are any code extensions at all
+- if (EncodingConverters.empty() || !checkForEscapeCharacter(fromString, fromLength))
++ // check whether there are or could be any code extensions
++ const OFBool hasEscapeChar = checkForEscapeCharacter(fromString, fromLength);
++ if (EncodingConverters.empty() || (!hasEscapeChar && delimiters.empty()))
+ {
+ DCMDATA_DEBUG("DcmSpecificCharacterSet: Converting '"
+ << convertToLengthLimitedOctalString(fromString, fromLength) << "'");
+@@ -564,10 +565,11 @@ OFCondition DcmSpecificCharacterSet::convertString(const char *fromString,
+ } else {
+ DCMDATA_DEBUG("DcmSpecificCharacterSet: Converting '"
+ << convertToLengthLimitedOctalString(fromString, fromLength)
+- << "' (with code extensions and delimiters '" << delimiters << "')");
++ << "' (with " << (hasEscapeChar ? "code extensions and " : "")
++ << "delimiters '" << delimiters << "')");
+ }
+- // code extensions according to ISO 2022 used, so we need to check for
+- // particular escape sequences in order to switch between character sets
++ // code extensions according to ISO 2022 (possibly) used, so we need to check
++ // for particular escape sequences in order to switch between character sets
+ toString.clear();
+ size_t pos = 0;
+ // some (extended) character sets use more than 1 byte per character
--- /dev/null
+From f06a867513524664a1b03dfcf812d8b60fdd02cc Mon Sep 17 00:00:00 2001
+From: Marco Eichelberg <dicom@offis.de>
+Date: Fri, 6 May 2022 17:30:02 +0200
+Subject: [PATCH] Fixed path traversal vulnerability.
+
+Thanks to Sharon Brizinov >sharon.b@claroty.com> and Noam Moshe from
+Claroty Research for the bug report and sample files.
+
+This closes DCMTK issue #1021.
+---
+ dcmnet/apps/movescu.cc | 3 ++-
+ dcmnet/apps/storescp.cc | 8 +++++--
+ dcmnet/libsrc/dstorscp.cc | 5 ++++-
+ dcmnet/libsrc/scu.cc | 1 +
+ ofstd/include/dcmtk/ofstd/ofstd.h | 18 +++++++++++++++-
+ ofstd/libsrc/offname.cc | 19 ++++++++++-------
+ ofstd/libsrc/ofstd.cc | 35 ++++++++++++++++++++++++++++++-
+ 7 files changed, 76 insertions(+), 13 deletions(-)
+
+diff --git a/dcmnet/apps/movescu.cc b/dcmnet/apps/movescu.cc
+index 40f41674c..7e444d46b 100644
+--- a/dcmnet/apps/movescu.cc
++++ b/dcmnet/apps/movescu.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1994-2021, OFFIS e.V.
++ * Copyright (C) 1994-2022, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -1425,6 +1425,7 @@ static OFCondition storeSCP(
+ sprintf(imageFileName, "%s.%s",
+ dcmSOPClassUIDToModality(req->AffectedSOPClassUID),
+ req->AffectedSOPInstanceUID);
++ OFStandard::sanitizeFilename(imageFileName);
+ }
+
+ OFString temp_str;
+diff --git a/dcmnet/apps/storescp.cc b/dcmnet/apps/storescp.cc
+index ee53f2887..68b7b4e97 100644
+--- a/dcmnet/apps/storescp.cc
++++ b/dcmnet/apps/storescp.cc
+@@ -1853,12 +1853,14 @@ storeSCPCallback(
+ if (!subdirectoryName.empty())
+ subdirectoryName += '_';
+ subdirectoryName += currentStudyInstanceUID;
++ OFStandard::sanitizeFilename(subdirectoryName);
+ break;
+ case ESM_PatientName:
+ // pattern: "[Patient's Name]_[YYYYMMDD]_[HHMMSSMMM]"
+ subdirectoryName = currentPatientName;
+ subdirectoryName += '_';
+ subdirectoryName += timestamp;
++ OFStandard::sanitizeFilename(subdirectoryName);
+ break;
+ case ESM_None:
+ break;
+@@ -2065,9 +2067,11 @@ static OFCondition storeSCP(
+ }
+ else
+ {
+- // don't create new UID, use the study instance UID as found in object
++ // Use the SOP instance UID as found in the C-STORE request message as part of the filename
++ OFString uid = req->AffectedSOPInstanceUID;
++ OFStandard::sanitizeFilename(uid);
+ sprintf(imageFileName, "%s%c%s.%s%s", opt_outputDirectory.c_str(), PATH_SEPARATOR, dcmSOPClassUIDToModality(req->AffectedSOPClassUID, "UNKNOWN"),
+- req->AffectedSOPInstanceUID, opt_fileNameExtension.c_str());
++ uid.c_str(), opt_fileNameExtension.c_str());
+ }
+ }
+
+diff --git a/dcmnet/libsrc/dstorscp.cc b/dcmnet/libsrc/dstorscp.cc
+index e491ae5ea..1811846a2 100644
+--- a/dcmnet/libsrc/dstorscp.cc
++++ b/dcmnet/libsrc/dstorscp.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2013-2021, OFFIS e.V.
++ * Copyright (C) 2013-2022, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -425,6 +425,7 @@ OFCondition DcmStorageSCP::generateDirAndFilename(OFString &filename,
+ generatedFileName = tmpString;
+ OFSTRINGSTREAM_FREESTR(tmpString);
+ // combine the generated file name with the directory name
++ OFStandard::sanitizeFilename(generatedFileName);
+ OFStandard::combineDirAndFilename(filename, directoryName, generatedFileName);
+ }
+ break;
+@@ -441,6 +442,7 @@ OFCondition DcmStorageSCP::generateDirAndFilename(OFString &filename,
+ generatedFileName = tmpString;
+ OFSTRINGSTREAM_FREESTR(tmpString);
+ // combine the generated file name with the directory name
++ OFStandard::sanitizeFilename(generatedFileName);
+ OFStandard::combineDirAndFilename(filename, directoryName, generatedFileName);
+ break;
+ }
+@@ -469,6 +471,7 @@ OFCondition DcmStorageSCP::generateDirAndFilename(OFString &filename,
+ generatedFileName = tmpString;
+ OFSTRINGSTREAM_FREESTR(tmpString);
+ // combine the generated file name
++ OFStandard::sanitizeFilename(generatedFileName);
+ OFStandard::combineDirAndFilename(filename, directoryName, generatedFileName);
+ } else
+ status = EC_CouldNotGenerateFilename;
+diff --git a/dcmnet/libsrc/scu.cc b/dcmnet/libsrc/scu.cc
+index 34b252553..1cc9c3a46 100644
+--- a/dcmnet/libsrc/scu.cc
++++ b/dcmnet/libsrc/scu.cc
+@@ -1418,6 +1418,7 @@ OFString DcmSCU::createStorageFilename(DcmDataset* dataset)
+ OFString name = dcmSOPClassUIDToModality(sopClassUID.c_str(), "UNKNOWN");
+ name += ".";
+ name += sopInstanceUID;
++ OFStandard::sanitizeFilename(name);
+ OFString returnStr;
+ OFStandard::combineDirAndFilename(returnStr, m_storageDir, name, OFTrue);
+ return returnStr;
+diff --git a/ofstd/include/dcmtk/ofstd/ofstd.h b/ofstd/include/dcmtk/ofstd/ofstd.h
+index 1548e26d0..56054ccb0 100644
+--- a/ofstd/include/dcmtk/ofstd/ofstd.h
++++ b/ofstd/include/dcmtk/ofstd/ofstd.h
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2000-2021, OFFIS e.V.
++ * Copyright (C) 2000-2022, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -1165,6 +1165,22 @@ class DCMTK_OFSTD_EXPORT OFStandard
+ */
+ static void forceSleep(Uint32 seconds);
+
++ /** sanitize a filename (NOT a path name!) by replacing all path
++ * separators with underscores. This avoids possible path traversal
++ * vulnerabilities if malformed data read from file or received over
++ * a network is used as part of a filename.
++ * @param fname filename to be sanitized
++ */
++ static void sanitizeFilename(OFString& fname);
++
++ /** sanitize a filename (NOT a path name!) by replacing all path
++ * separators with underscores. This avoids possible path traversal
++ * vulnerabilities if malformed data read from file or received over
++ * a network is used as part of a filename.
++ * @param fname filename to be sanitized
++ */
++ static void sanitizeFilename(char *fname);
++
+ private:
+
+ /** private implementation of strlcpy. Called when strlcpy
+diff --git a/ofstd/libsrc/offname.cc b/ofstd/libsrc/offname.cc
+index 832376189..a56a7e1b5 100644
+--- a/ofstd/libsrc/offname.cc
++++ b/ofstd/libsrc/offname.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 1997-2021, OFFIS e.V.
++ * Copyright (C) 1997-2022, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -73,18 +73,23 @@ OFBool OFFilenameCreator::makeFilename(unsigned int &seed, const char *dir, cons
+ {
+ // create filename
+ filename.clear();
+- if (dir)
+- {
+- filename = dir;
+- filename += PATH_SEPARATOR;
+- }
+- if (prefix) filename += prefix;
++ if (prefix) filename = prefix;
+ addLongToString(creation_time, filename);
+ // on some systems OFrand_r may produce only 16-bit random numbers.
+ // To be on the safe side, we use two random numbers for the upper and the lower 16 bits.
+ addLongToString((((OFrand_r(seed) & 0xFFFF) << 16) | (OFrand_r(seed) & 0xFFFF)), filename);
+ if (postfix) filename += postfix;
+
++ OFStandard::sanitizeFilename(filename);
++
++ if (dir)
++ {
++ OFString dirname = dir;
++ dirname += PATH_SEPARATOR;
++ dirname += filename;
++ filename = dirname;
++ }
++
+ // check if filename exists
+ stat_result = stat(filename.c_str(), &stat_buf);
+ if (stat_result == 0)
+diff --git a/ofstd/libsrc/ofstd.cc b/ofstd/libsrc/ofstd.cc
+index ae1466a9f..33ecd7954 100644
+--- a/ofstd/libsrc/ofstd.cc
++++ b/ofstd/libsrc/ofstd.cc
+@@ -1,6 +1,6 @@
+ /*
+ *
+- * Copyright (C) 2001-2021, OFFIS e.V.
++ * Copyright (C) 2001-2022, OFFIS e.V.
+ * All rights reserved. See COPYRIGHT file for details.
+ *
+ * This software and supporting documentation were developed by
+@@ -3245,6 +3245,39 @@ void OFStandard::forceSleep(Uint32 seconds)
+ }
+ }
+
++
++void OFStandard::sanitizeFilename(OFString& fname)
++{
++ size_t len = fname.length();
++ for (size_t i=0; i<len; ++i)
++ {
++#ifdef _WIN32
++ if ((fname[i] == PATH_SEPARATOR)||(fname[i] == '/')) fname[i] = '_';
++#else
++ if (fname[i] == PATH_SEPARATOR) fname[i] = '_';
++#endif
++ }
++}
++
++
++void OFStandard::sanitizeFilename(char *fname)
++{
++ if (fname)
++ {
++ char *c = fname;
++ while (*c)
++ {
++#ifdef _WIN32
++ if ((*c == PATH_SEPARATOR)||(*c == '/')) *c = '_';
++#else
++ if (*c == PATH_SEPARATOR) *c = '_';
++#endif
++ ++c;
++ }
++ }
++}
++
++
+ #include DCMTK_DIAGNOSTIC_IGNORE_STRICT_ALIASING_WARNING
+
+ // black magic:
+--
+2.30.2
+
--- /dev/null
+Description: Remove version
+Author: Mathieu Malaterre <malat@debian.org>
+Forwarded: not-needed
+Last-Update: 2023-11-06
+
+Index: dcmtk/CMake/GenerateDCMTKConfigure.cmake
+===================================================================
+--- dcmtk.orig/CMake/GenerateDCMTKConfigure.cmake
++++ dcmtk/CMake/GenerateDCMTKConfigure.cmake
+@@ -202,8 +202,8 @@ else()
+
+ # Modify the installation paths for configuration files, data files and documents
+ # by adding a subdirectory with the DCMTK name and version number
+- set(CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/dcmtk-${DCMTK_COMPLETE_PACKAGE_VERSION}")
+- set(CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/dcmtk-${DCMTK_COMPLETE_PACKAGE_VERSION}")
++ set(CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/dcmtk")
++ set(CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/dcmtk")
+ set(CMAKE_INSTALL_FULL_DOCDIR "${CMAKE_INSTALL_FULL_DOCDIR}-${DCMTK_COMPLETE_PACKAGE_VERSION}")
+
+ # These variables are defined as macros in osconfig.h and must end with a path separator
--- /dev/null
+01_dcmtk_3.6.0-1.patch
+#03_datadic_install.patch
+07_dont_export_all_executables.patch
+#bigendian.patch
+#bug1000220.patch
+#test_failures.patch
+#3ae202ee9d8f27054ad0c463a6799d8b10b4864b.patch
+#0cf6b12d8ea0b727f0fe2ab076b6f180100fbd30.patch
+#ab61e8577ff0974efcfae2907c48baf6023c1160.patch
+#1c8cca4bf6f7c92fc16f9e66faf49409c891a2b0.patch
+#f06a867513524664a1b03dfcf812d8b60fdd02cc.patch
+remove_version.patch
+da5370947226783ce3548bf1e5b7112fac70de46.patch
+0001-Fixed-unchecked-typecasts-of-DcmItem-search-results.patch
+0002-Fixed-unchecked-typecasts-and-fixed-LUT-handling.patch
+0003-Fixed-wrong-error-handling-previous-commit.patch
+0004-Fixed-two-segmentation-faults.patch
+0005-Fixed-DcmDecimalString-unit-tests.patch
+0006-Fixed-possible-overflows-when-allocating-memory.patch
+0007-CVE-2024-47796.patch
+0008-CVE-2024-52333.patch
--- /dev/null
+Author: Mathieu Malaterre <malat@debian.org>
+Description: Fix random failure of unit test
+ Concatenation of upstream commits:
+ .
+ - cfbdf2748a9291d4d6170518b43d1d4258f8b272
+ - 21eda2341946527f2f01e2be2b8a3a8e66a415f6
+ - 0832266a6522214d191dc12771ff865ee9d07251
+Forwarded: not-needed
+
+Index: dcmtk/dcmtls/tests/tscuscptls.cc
+===================================================================
+--- dcmtk.orig/dcmtls/tests/tscuscptls.cc
++++ dcmtk/dcmtls/tests/tscuscptls.cc
+@@ -17,7 +17,7 @@
+ *
+ * Purpose: TLS test for classes DcmSCP and DcmSCPPool
+ *
+- * Note: This test will fail after 2029-02-25 due to certificate expiry.
++ * Note: This test will fail after 2029-02-25 due to certificate expiry.
+ * The keys embedded in this file should be replaced then (see below).
+ *
+ */
+@@ -28,6 +28,7 @@
+ #include "dcmtk/ofstd/ofstdinc.h"
+ #include "dcmtk/ofstd/oftest.h"
+ #include "dcmtk/ofstd/oftimer.h"
++#include "dcmtk/ofstd/ofrand.h"
+ #include "dcmtk/oflog/consap.h"
+ #include "dcmtk/dcmnet/scp.h"
+ #include "dcmtk/dcmnet/scu.h"
+@@ -37,6 +38,11 @@
+
+ #ifdef WITH_THREADS
+
++#define BAILOUT(msg) do { \
++ OFCHECK_FAIL(msg); \
++ return; \
++} while (0)
++
+ /** Method that ensures that the current thread is actually sleeping for the
+ * defined number of seconds (at least).
+ * The problem with the regular sleep() function called from OFStandard::sleep
+@@ -72,7 +78,8 @@ struct TestSCP: DcmSCP, OFThread
+ DcmSCP(),
+ m_listen_result(EC_NotYetImplemented), // value indicating "not set"
+ m_set_stop_after_assoc(OFFalse),
+- m_set_stop_after_timeout(OFFalse)
++ m_set_stop_after_timeout(OFFalse),
++ m_is_running(OFFalse)
+ {
+ }
+
+@@ -83,6 +90,7 @@ struct TestSCP: DcmSCP, OFThread
+ m_listen_result = EC_NotYetImplemented;
+ m_set_stop_after_assoc = OFFalse;
+ m_set_stop_after_timeout = OFFalse;
++ m_is_running = OFFalse;
+ }
+
+ /** Overwrite method from DcmSCP in order to test feature to stop after current
+@@ -109,12 +117,16 @@ struct TestSCP: DcmSCP, OFThread
+ OFBool m_set_stop_after_assoc;
+ /// If set, the SCP should stop after TCP timeout occurred in non-blocking mode
+ OFBool m_set_stop_after_timeout;
++ /// indicates whether the thread is currently running
++ volatile OFBool m_is_running;
+
+ /** Method called by OFThread to start SCP operation. Starts listen() loop of DcmSCP.
+ */
+ virtual void run()
+ {
++ m_is_running = OFTrue;
+ m_listen_result = listen();
++ m_is_running = OFFalse;
+ }
+
+ };
+@@ -123,11 +135,22 @@ struct TestSCP: DcmSCP, OFThread
+
+ struct TestPool : DcmSCPPool<>, OFThread
+ {
+- OFCondition result;
++ OFCondition m_listen_result;
++ volatile OFBool m_is_running;
++
++ TestPool()
++ : DcmSCPPool<>()
++ , OFThread()
++ , m_listen_result(EC_NotYetImplemented)
++ , m_is_running(OFFalse)
++ { }
++
+ protected:
+ void run()
+ {
+- result = listen();
++ m_is_running = OFTrue;
++ m_listen_result = listen();
++ m_is_running = OFFalse;
+ }
+ };
+
+@@ -300,9 +323,9 @@ OFTEST_FLAGS(dcmtls_scp_tls, EF_None)
+ scpTlsLayer.setCertificateVerification(DCV_ignoreCertificate);
+
+ /// Init and run Scp server with tls
++ OFRandom rnd;
+ TestSCP scp;
+ DcmSCPConfig& config = scp.getConfig();
+- config.setPort(11112);
+ config.setAETitle("ACCEPTOR");
+ config.setACSETimeout(30);
+ config.setConnectionTimeout(1);
+@@ -315,10 +338,24 @@ OFTEST_FLAGS(dcmtls_scp_tls, EF_None)
+ OFCHECK(config.addPresentationContext(UID_VerificationSOPClass, xfers, ASC_SC_ROLE_SCP).good());
+
+ config.setTransportLayer(&scpTlsLayer);
+- scp.start();
+
+ // Ensure server is up and listening
+- force_sleep(1);
++ int i = 0;
++ Uint16 port_number = 0;
++ OFMutex memory_barrier;
++ do
++ {
++ // generate a random port number between 61440 (0xF000) and 65535
++ port_number = 0xF000 + (rnd.getRND16() & 0xFFF);
++ config.setPort(port_number);
++ scp.start();
++ force_sleep(2); // wait 2 seconds for the SCP process to start
++ memory_barrier.lock();
++ memory_barrier.unlock();
++ }
++ while ((i++ < 5) && (! scp.m_is_running)); // try up to 5 port numbers before giving up
++
++ if (! scp.m_is_running) BAILOUT("Start of the SCP thread failed: " << scp.m_listen_result.text());
+
+ // Configure SCU and run it against SCP
+ DcmTLSSCU scu;
+@@ -329,7 +366,7 @@ OFTEST_FLAGS(dcmtls_scp_tls, EF_None)
+ scu.setPeerAETitle("ACCEPTOR");
+ scu.setAETitle("REQUESTOR");
+ scu.setPeerHostName("localhost");
+- scu.setPeerPort(11112);
++ scu.setPeerPort(port_number);
+
+ scu.enableAuthentication(PRIVATE_KEY_FILENAME, PUBLIC_SELFSIGNED_CERT_FILENAME, PRIVATE_KEY_PWD, DCF_Filetype_PEM, DCF_Filetype_PEM);
+ scu.setPeerCertVerification(DCV_ignoreCertificate);
+@@ -368,9 +405,9 @@ OFTEST_FLAGS(dcmtls_scp_pool_tls, EF_Non
+ scpTlsLayer.setCertificateVerification(DCV_ignoreCertificate);
+
+ /// Init and run Scp server with tls
++ OFRandom rnd;
+ TestPool pool;
+ DcmSCPConfig& config = pool.getConfig();
+- config.setPort(11112);
+ config.setAETitle("ACCEPTOR");
+ config.setACSETimeout(30);
+ config.setConnectionTimeout(1);
+@@ -383,10 +420,23 @@ OFTEST_FLAGS(dcmtls_scp_pool_tls, EF_Non
+ OFCHECK(config.addPresentationContext(UID_VerificationSOPClass, xfers, ASC_SC_ROLE_DEFAULT).good());
+ config.setTransportLayer(&scpTlsLayer);
+ pool.setMaxThreads(20);
+- pool.start();
+
+ // Ensure server is up and listening
+- force_sleep(1);
++ int i = 0;
++ Uint16 port_number = 0;
++ OFMutex memory_barrier;
++ do
++ {
++ // generate a random port number between 61440 (0xF000) and 65535
++ port_number = 0xF000 + (rnd.getRND16() & 0xFFF);
++ config.setPort(port_number);
++ pool.start();
++ force_sleep(2); // wait 2 seconds for the SCP process to start
++ memory_barrier.lock();
++ memory_barrier.unlock();
++ }
++ while ((i++ < 5) && (! pool.m_is_running)); // try up to 5 port numbers before giving up
++ if (! pool.m_is_running) BAILOUT("Start of the SCP thread ppol failed: " << pool.m_listen_result.text());
+
+ OFVector<TestTLSSCU*> scus(20);
+ OFVector<DcmTLSTransportLayer*> scuTlsLayers;
+@@ -400,7 +450,7 @@ OFTEST_FLAGS(dcmtls_scp_pool_tls, EF_Non
+ (*it1)->setPeerAETitle("ACCEPTOR");
+ (*it1)->setAETitle("REQUESTOR");
+ (*it1)->setPeerHostName("localhost");
+- (*it1)->setPeerPort(11112);
++ (*it1)->setPeerPort(port_number);
+ (*it1)->enableAuthentication(PRIVATE_KEY_FILENAME, PUBLIC_SELFSIGNED_CERT_FILENAME, PRIVATE_KEY_PWD, DCF_Filetype_PEM, DCF_Filetype_PEM);
+ (*it1)->setPeerCertVerification(DCV_ignoreCertificate);
+
--- /dev/null
+#!/usr/bin/make -f
+#export DH_VERBOSE=1
+
+# export DEB_BUILD_MAINT_OPTIONS = hardening=+pie
+ifeq ($(DEB_TARGET_ARCH),armel)
+ # https://lists.debian.org/debian-arm/2024/01/msg00031.html
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1060104
+ export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-stackclash optimize=+lto
+else
+ export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+lto
+endif
+
+# needed for the tests
+export DCMDICTPATH=$(CURDIR)/dcmdata/data/dicom.dic
+
+# deduce documentation option (build-indep target)
+ifeq "" "$(filter %-doc,$(shell dh_listpackages))"
+ BUILDDOC = OFF
+else
+ BUILDDOC = ON
+endif
+
+ifeq ($(DEB_HOST_ARCH_CPU),i386)
+ DEB_CXXFLAGS_MAINT_APPEND += -fexcess-precision=fast
+endif
+
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001703
+DEB_CXXFLAGS_MAINT_APPEND += -DENABLE_DCMJPLS_INTERLEAVE_NONE
+export DEB_CXXFLAGS_MAINT_APPEND
+
+# when BUILDDOC==OFF, convenient copies of doxygen man pages are used
+# when BUILDDOC==ON, doxygen man pages are being regenerated, this may leads to
+# improper md5sum...
+
+%:
+ dh $@ --buildsystem=cmake
+
+CMAKE_EXTRA_FLAGS += \
+ -DBUILD_SHARED_LIBS:BOOL=ON \
+ -DCMAKE_BUILD_TYPE:STRING=None \
+ -DCMAKE_CXX_EXTENSIONS:BOOL=OFF \
+ -DCMAKE_CXX_STANDARD:STRING=17 \
+ -DCMAKE_INSTALL_DATADIC:STRING=share/libdcmtk18 \
+ -DCMAKE_SKIP_RPATH:BOOL=ON \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DDCMTK_ENABLE_PRIVATE_TAGS:BOOL=ON \
+ -DDCMTK_ENABLE_STL:BOOL=ON \
+ -DDCMTK_WITH_DOXYGEN:BOOL=$(BUILDDOC) \
+ -DDCMTK_WITH_ICONV:BOOL=OFF \
+ -DDCMTK_WITH_ICU:BOOL=OFF \
+ -DDCMTK_WITH_OPENSSL:BOOL=ON \
+ -DDCMTK_WITH_STDLIBC_ICONV:BOOL=OFF \
+ -DDCMTK_WITH_TIFF:BOOL=ON \
+ -DDCMTK_WITH_XML:BOOL=ON \
+ -DDCMTK_WITH_ZLIB:BOOL=ON \
+ -DUSE_COMPILER_HIDDEN_VISIBILITY:BOOL=ON \
+
+ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+ CMAKE_EXTRA_FLAGS += -DBUILD_TESTING:BOOL=OFF
+endif
+
+override_dh_auto_configure:
+ dh_auto_configure -- $(CMAKE_EXTRA_FLAGS)
+
+override_dh_auto_build-arch:
+ # need man page in -arch packages:
+ #$(MAKE) -C obj-* man
+ dh_auto_build
+ sed -i 's% -ffile-prefix-map=[^ ]* % %' obj-*/CMakeFiles/DCMTKConfig.cmake
+
+# Let's be smart with building doc
+override_dh_auto_build-indep:
+ $(MAKE) -C obj-* DOXYGEN
+
+override_dh_auto_test-arch:
+ LD_LIBRARY_PATH=$(wildcard $(CURDIR)/obj-*/lib):$(LD_LIBRARY_PATH) dh_auto_test
+
+# No tests needed for docs
+override_dh_auto_test-indep:
+
+override_dh_auto_install-arch:
+ dh_auto_install
+
+override_dh_auto_install-indep:
+ # DESTDIR=$(CURDIR)/debian/tmp cmake --install obj-* --component data
+ DESTDIR=$(CURDIR)/debian/tmp $(MAKE) -C obj-*/doxygen install
+ DESTDIR=$(CURDIR)/debian/tmp $(MAKE) -C obj-*/dcmwlm/data install
+ DESTDIR=$(CURDIR)/debian/tmp $(MAKE) -C obj-*/dcmdata/data install
+ DESTDIR=$(CURDIR)/debian/tmp $(MAKE) -C obj-*/oficonv/data install
+
+
+override_dh_installdocs:
+ dh_installdocs
+ # do the doxygen / jquery fix:
+ dh_link -pdcmtk-doc usr/share/javascript/jquery/jquery.js usr/share/doc/dcmtk-doc/html/jquery.js
+
+override_dh_install-arch:
+ dh_install # --list-missing
+ #remove test binaries
+ rm ./debian/dcmtk/usr/bin/*_tests
+ rm ./debian/dcmtk/usr/bin/drttest
+ rm ./debian/dcmtk/usr/bin/mkreport
+ rm ./debian/dcmtk/usr/bin/msgserv
+ rm ./debian/dcmtk/usr/bin/wltest
+
+
+.PHONY: get-orig-source
--- /dev/null
+3.0 (quilt)
--- /dev/null
+Tests: run-unit-test
+Depends: python3-pydicom, @
+Restrictions: allow-stderr
--- /dev/null
+#!/bin/sh
+set -e
+
+pkg=dcmtk
+
+CUR_DIR=`pwd`
+
+
+export LC_ALL=C.UTF-8
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+ AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+ trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cp -a /usr/lib/python3/dist-packages/pydicom/data/test_files/CT_small.dcm "${AUTOPKGTEST_TMP}"
+cp -a /usr/share/dcmtk/dicom.dic "${AUTOPKGTEST_TMP}"
+
+
+export DCMDICTPATH=${AUTOPKGTEST_TMP}/dicom.dic
+
+cd "${AUTOPKGTEST_TMP}"
+
+echo "896048a80ff192ca8b6d9a1ba29d64fd CT_small.dcm" >> checksums
+
+echo "Running Tests"
+
+echo "Test 1"
+
+dcm2json CT_small.dcm dcm2json.json
+
+echo "Test 2"
+
+dcm2xml CT_small.dcm dcm2xml.xml
+
+echo "Test 3"
+
+dcmconv --convert-to-latin1 CT_small.dcm dcmconv.out
+
+echo "Test 4"
+
+dcmcrle CT_small.dcm dcmcrle.out
+
+echo "Test 5"
+
+dcmdrle dcmcrle.out dcmdrle.out
+
+echo "Test 6"
+
+dcmdump CT_small.dcm > dcmdump.out
+
+echo "Test 7"
+
+dump2dcm dcmdump.out dump2dcm.dcm
+
+echo "Test 8"
+
+dcmftest CT_small.dcm
+
+echo "Test 9"
+
+# only write the dataset so that the file meta information
+# does not change and we can keep the same md5sum
+
+dcmodify --write-dataset -e "(0008,0031)" CT_small.dcm
+
+echo "Test 10"
+
+dcm2pnm +Rtd CT_small.dcm dcm2pnm.png
+
+echo "Test 11"
+
+dcmscale +Sxf 2.0 CT_small.dcm dcmscale.out
+
+echo "Test 12"
+
+dcmcjpls CT_small.dcm dcmcjpls.out
+
+echo "Test 13"
+
+dcmdjpls dcmcjpls.out dcmdjpls.out
+
+echo "Test 14"
+
+dcml2pnm CT_small.dcm dcml2pnm.png
+
+echo "Test 15"
+
+cat <<EOT >> crv.txt
+ 256.451947 1.000000
+ 477.689863 128.822080
+ 128.822080 477.689863
+ 35.310137 128.822080
+ 256.451947 1.000000
+EOT
+
+dcmmkcrv CT_small.dcm crv.txt dcmmkcrv.out
+
+echo "Test 16"
+
+dcmmklut dcmmklut.out
+
+echo "Test 17"
+
+dcmp2pgm CT_small.dcm dcmp2pgm.out
+
+echo "Test 18"
+dcmpsmk CT_small.dcm dcmpsmk.out
+
+echo "Test 19"
+mkdir dcmqridx
+
+dcmqridx dcmqridx/ CT_small.dcm
+
+echo "Test 20"
+dcmsign -q CT_small.dcm
+
+if [ -f dcmqridx/index.dat ] && \
+ [ -f dcmpsmk.out ] && \
+ [ -f dcmmklut.out ] && \
+ [ -f dcm2json.json ] && \
+ [ -f dcm2xml.xml ] && \
+ [ -f dcmconv.out ] && \
+ [ -f dcmcrle.out ] && \
+ [ -f dcmdrle.out ] && \
+ [ -f dcmdump.out ] && \
+ [ -f dump2dcm.dcm ] && \
+ [ -f dcm2pnm.png ] && \
+ [ -f dcmscale.out ] && \
+ [ -f dcmcjpls.out ] && \
+ [ -f dcmdjpls.out ] && \
+ [ -f dcml2pnm.png ] && \
+ [ -f dcmmkcrv.out ] && \
+ [ -f dcmp2pgm.out ] && \
+ md5sum --check checksums; then
+
+ echo "PASS"
+
+else
+ echo "FAIL"
+
+fi
+
--- /dev/null
+Repository: https://git.dcmtk.org/?p=dcmtk.git
+Repository-Browse: https://git.dcmtk.org/?p=dcmtk.git
+Bug-Database: https://support.dcmtk.org/redmine/issues/
+Reference:
+ Author: >
+ Lien, Chung-Yueh and Onken, Michael and Eichelberg, Marco and
+ Kao, Tsair and Hein, Andreas
+ Title: Open Source Tools for Standardized Privacy Protection of Medical Images
+ Journal: Progress in Biomedical Optics and Imaging - Proceedings of SPIE
+ Year: 2011
+ Volume: 7967
+ Pages: 79670M-79670M
+ DOI: 10.1117/12.877989
+ URL: https://www.researchgate.net/publication/234046268_Open_Source_Tools_for_Standardized_Privacy_Protection_of_Medical_Images
+ eprint: https://www.researchgate.net/publication/234046268_Open_Source_Tools_for_Standardized_Privacy_Protection_of_Medical_Images
--- /dev/null
+version=4
+opts="mode=git,pgpmode=none,pretty=3.6.8~git%cd.%h" \
+https://github.com/DCMTK/dcmtk \
+HEAD debian uupdate