[med-svn] [Git][med-team/dcmtk][master] 2 commits: Update two of the previously applied patches to avoid breaking the ABI. Closes: #1070207.

Santiago Vila (@sanvila) gitlab at salsa.debian.org
Mon Jun 24 11:36:37 BST 2024



Santiago Vila pushed to branch master at Debian Med / dcmtk


Commits:
965a8033 by Santiago Vila at 2024-06-24T12:31:14+02:00
Update two of the previously applied patches to avoid breaking the ABI. Closes: #1070207.

The updated patches are:

0001-Fixed-unchecked-typecasts-of-DcmItem-search-results.patch
0003-Fixed-wrong-error-handling-previous-commit.patch

- - - - -
d4ea4513 by Santiago Vila at 2024-06-24T12:33:56+02:00
Upload for unstable as 3.6.7-15

- - - - -


3 changed files:

- debian/changelog
- debian/patches/0001-Fixed-unchecked-typecasts-of-DcmItem-search-results.patch
- debian/patches/0003-Fixed-wrong-error-handling-previous-commit.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+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 at debian.org>  Mon, 24 Jun 2024 12:30:00 +0200
+
 dcmtk (3.6.7-14) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/patches/0001-Fixed-unchecked-typecasts-of-DcmItem-search-results.patch
=====================================
@@ -1,4 +1,4 @@
-From 490f9dd15d1c98cd3b79e5088136cda1fb2d7405 Mon Sep 17 00:00:00 2001
+From b8e1d6f7a0e2fba1b0dd138c790751bf88220464 Mon Sep 17 00:00:00 2001
 From: Marco Eichelberg <dicom at offis.de>
 Date: Mon, 15 Apr 2024 12:12:51 +0200
 Subject: Fixed unchecked typecasts of DcmItem::search results.
@@ -12,86 +12,42 @@ 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   |  5 +++
- 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                 | 14 ++++----
- dcmimgle/libsrc/didocu.cc                |  2 +-
- dcmiod/libsrc/iodutil.cc                 |  4 +--
- dcmjpeg/libsrc/djcodece.cc               |  8 ++---
- dcmnet/apps/storescu.cc                  |  6 ++++
- dcmnet/libsrc/dimcmd.cc                  | 38 ++++++++++++---------
- dcmnet/libsrc/diutil.cc                  | 28 ++++++++--------
- dcmnet/libsrc/dstorscu.cc                |  2 +-
- dcmpstat/apps/dcmmklut.cc                |  4 +--
- dcmpstat/apps/dcmpschk.cc                |  6 +++-
- 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               |  2 +-
- 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               | 20 +++++------
- dcmsign/libsrc/sicert.cc                 |  4 +--
- dcmsr/libsrc/dsrtypes.cc                 |  4 +--
- 39 files changed, 191 insertions(+), 167 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
+ dcmdata/libsrc/dcddirif.cc |  4 ++--
+ dcmdata/libsrc/dcdirrec.cc |  6 +++---
+ dcmdata/libsrc/dcfilefo.cc | 12 +++++------
+ dcmdata/libsrc/dcitem.cc   | 14 ++++++-------
+ dcmimgle/libsrc/didocu.cc  |  2 +-
+ dcmiod/libsrc/iodutil.cc   |  4 ++--
+ dcmjpeg/libsrc/djcodece.cc |  8 ++++----
+ dcmnet/apps/storescu.cc    |  6 ++++++
+ dcmnet/libsrc/dimcmd.cc    | 38 ++++++++++++++++++++--------------
+ dcmnet/libsrc/diutil.cc    | 28 ++++++++++++-------------
+ dcmnet/libsrc/dstorscu.cc  |  2 +-
+ dcmpstat/apps/dcmmklut.cc  |  4 ++--
+ dcmpstat/apps/dcmpschk.cc  |  6 +++++-
+ 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 |  2 +-
+ 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 | 20 +++++++++---------
+ dcmsign/libsrc/sicert.cc   |  4 ++--
+ dcmsr/libsrc/dsrtypes.cc   |  4 ++--
+ 34 files changed, 180 insertions(+), 166 deletions(-)
 
---- a/dcmdata/include/dcmtk/dcmdata/dcelem.h
-+++ b/dcmdata/include/dcmtk/dcmdata/dcelem.h
-@@ -143,6 +143,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
-      */
---- a/dcmdata/include/dcmtk/dcmdata/dcobject.h
-+++ b/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
 --- a/dcmdata/libsrc/dcddirif.cc
 +++ b/dcmdata/libsrc/dcddirif.cc
 @@ -433,7 +433,7 @@
@@ -99,7 +55,7 @@ value representation.
              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())
++            while (item1->nextObject(stack1, first).good() && item2->nextObject(stack2, first).good() && (dynamic_cast<DcmElement*>(stack1.top()) != nullptr) && (dynamic_cast<DcmElement*>(stack2.top()) != nullptr))
              {
                  if (!compareAttributes(OFstatic_cast(DcmElement *, stack1.top()), OFstatic_cast(DcmElement *, stack2.top()), fromSequence, i++, reason))
                      break;
@@ -108,7 +64,7 @@ value representation.
          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())
++        while (record->nextObject(stack, first).good() && (result || !abortCheck) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
          {
              delem = OFstatic_cast(DcmElement *, stack.top());
              if ((delem != NULL) && (delem->getLength() > 0))
@@ -203,7 +159,7 @@ value representation.
      OFBool result = OFFalse;
  
 -    if (search(key, stack, ESM_fromHere, searchIntoSub).good())
-+    if (search(key, stack, ESM_fromHere, searchIntoSub).good() && stack.top()->isElement())
++    if (search(key, stack, ESM_fromHere, searchIntoSub).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          DcmElement *elem = OFstatic_cast(DcmElement *, stack.top());
          if (elem != NULL)
@@ -212,7 +168,7 @@ value representation.
      /* find the element */
      OFCondition status = search(tagKey, stack, ESM_fromHere, searchIntoSub);
 -    if (status.good())
-+    if (status.good() && stack.top()->isElement())
++    if (status.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          element = OFstatic_cast(DcmElement *, stack.top());
          /* should never happen but ... */
@@ -221,7 +177,7 @@ value representation.
      /* find the element */
      OFCondition status = search(seqTagKey, stack, ESM_fromHere, searchIntoSub);
 -    if (status.good())
-+    if (status.good() && stack.top()->isElement())
++    if (status.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
          /* should never happen but ... */
@@ -230,7 +186,7 @@ value representation.
      /* find sequence */
      OFCondition status = search(seqTagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
 -    if (status.good())
-+    if (status.good() && stack.top()->isElement())
++    if (status.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          /* get element */
          DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
@@ -239,7 +195,7 @@ value representation.
      DcmSequenceOfItems *sequence = NULL;
      /* sequence found? */
 -    if (status.good())
-+    if (status.good() && stack.top()->isElement())
++    if (status.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          /* get element */
          DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
@@ -248,7 +204,7 @@ value representation.
      /* find sequence */
      OFCondition status = search(seqTagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
 -    if (status.good())
-+    if (status.good() && stack.top()->isElement())
++    if (status.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          /* get element */
          DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
@@ -257,7 +213,7 @@ value representation.
          DcmSequenceOfItems *sequence = NULL;
          /* sequence found? */
 -        if (status.good())
-+        if (status.good() && stack.top()->isElement())
++        if (status.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
          {
              /* get element */
              DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
@@ -268,7 +224,7 @@ value representation.
      // 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())
++        (stack.top()->getLength(Xfer) > 0) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          return OFstatic_cast(DcmElement *, stack.top());
      }
@@ -279,7 +235,7 @@ value representation.
      const DcmTagKey tagKey = delem.getTag();
      OFCondition result     = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
 -    if (result.good())
-+    if (result.good() && stack.top()->isElement())
++    if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          /* copy object from search stack */
          result = delem.copyFrom(*stack.top());
@@ -288,7 +244,7 @@ value representation.
      DcmStack stack;
      OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
 -    if (result.good())
-+    if (result.good() && stack.top()->isElement())
++    if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          /* copy object from search stack */
          delem = OFstatic_cast(DcmElement*, stack.top()->clone());
@@ -307,19 +263,19 @@ value representation.
  
    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())
++  if ((dataset->search(DCM_WindowCenter, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      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())
++  if ((dataset->search(DCM_WindowWidth, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      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())
++  if ((dataset->search(DCM_WindowCenterWidthExplanation, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      explanation = OFreinterpret_cast(DcmElement*, stack.top());
    }
@@ -329,7 +285,7 @@ value representation.
      return OFFalse;
    }
  
-+  if (! stack.top()->isElement())
++  if (! (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +  {
 +    OFLOG_ERROR(storescuLogger, "updateStringAttributeValue: not a DcmElement: " << tag.getTagName() << " " << key);
 +    return OFFalse;
@@ -353,7 +309,7 @@ value representation.
      ec = obj->search(t, stack);
 -    elem = (DcmElement*)stack.top();
 -    if (ec == EC_Normal && elem != NULL) {
-+    if (ec.good() && stack.top()->isElement())
++    if (ec.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +        elem = (DcmElement*)stack.top();
 +
 +    if (elem != NULL) {
@@ -372,7 +328,7 @@ value representation.
      ec = obj->search(t, stack);
 -    elem = (DcmElement*)stack.top();
 -    if (ec == EC_Normal && elem != NULL) {
-+    if (ec.good() && stack.top()->isElement())
++    if (ec.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +        elem = (DcmElement*)stack.top();
 +
 +    if (elem != NULL) {
@@ -396,7 +352,7 @@ value representation.
      ec = obj->search(t, stack);
 -    elem = (DcmElement*)stack.top();
 -    if (ec == EC_Normal && elem != NULL) {
-+    if (ec.good() && stack.top()->isElement())
++    if (ec.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +        elem = (DcmElement*)stack.top();
 +
 +    if (elem != NULL) {
@@ -422,7 +378,7 @@ value representation.
      ec = obj->search(t, stack);
 -    elem = (DcmElement*)stack.top();
 -    if (ec == EC_Normal && elem != NULL) {
-+    if (ec.good() && stack.top()->isElement())
++    if (ec.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +        elem = (DcmElement*)stack.top();
 +
 +    if (elem) {
@@ -453,7 +409,7 @@ value representation.
 -    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()) {
++    if (ec.good() && (stack.top() != NULL) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr)) {
 +        DcmElement *elem = (DcmElement *) stack.top();
          if (elem->getLength() == 0) {
              s[0] = '\0';
@@ -489,7 +445,7 @@ value representation.
 -    if (ec == EC_Normal && elem != NULL) {
 -        ec = elem->getUint16(*us, 0);
 +    OFCondition ec = obj->search(t, stack);
-+    if (ec.good() && stack.top()->isElement())
++    if (ec.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +    {
 +        elem = (DcmElement*) stack.top();
 +        if (elem) ec = elem->getUint16(*us, 0);
@@ -516,7 +472,7 @@ value representation.
          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())
++        while (dataset->search(DCM_ReferencedFileID, stack, ESM_afterStackTop, OFTrue).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
          {
              // make sure that the dataset and element pointer are there
              if (stack.card() > 1)
@@ -547,7 +503,7 @@ value representation.
  
      ec = dset->search(key, stack, ESM_fromHere, OFFalse);
 -    elem = (DcmElement*) stack.top();
-+    if (ec.good() && stack.top()->isElement())
++    if (ec.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +    {
 +        elem = (DcmElement*) stack.top();
 +    }
@@ -579,13 +535,13 @@ value representation.
    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())
++    if (EC_Normal == dset->search(DCM_SOPInstanceUID, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
        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())
++    if (EC_Normal == dset->search(DCM_SOPClassUID, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
        OFstatic_cast(DcmElement *, stack.top())->getString(classUID);
      }
@@ -632,7 +588,7 @@ value representation.
    /* 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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_curveData = (DcmElement *)(stack.top());
    } else return EC_IllegalCall;
@@ -640,7 +596,7 @@ value representation.
    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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_curveDimensions = (DcmElement *)(stack.top());
    } else return EC_IllegalCall;
@@ -649,7 +605,7 @@ value representation.
    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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_numberOfPoints = (DcmElement *)(stack.top());
    } else return EC_IllegalCall;
@@ -657,7 +613,7 @@ value representation.
    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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_typeOfData = (DcmElement *)(stack.top());
    } else return EC_IllegalCall;
@@ -665,7 +621,7 @@ value representation.
    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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_dataVR = (DcmElement *)(stack.top());
    } else return EC_IllegalCall;
@@ -673,7 +629,7 @@ value representation.
    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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_curveDescription = (DcmElement *)(stack.top());
    }
@@ -681,7 +637,7 @@ value representation.
    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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_axisUnits = (DcmElement *)(stack.top());
    }
@@ -689,7 +645,7 @@ value representation.
    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())
++  if (EC_Normal == dset.search(key, stack, ESM_fromHere, OFFalse) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      d_curveLabel = (DcmElement *)(stack.top());
    }
@@ -1066,7 +1022,7 @@ value representation.
    {
      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())
++    if (rqDataset && (EC_Normal == rqDataset->search(DCM_PixelData, stack, ESM_fromHere, OFFalse)) && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
        pixelData = new DcmPixelData(DCM_PixelData);
        if (pixelData)
@@ -1381,7 +1337,7 @@ value representation.
      DcmStack stack;
      OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
 -    if (result.good())
-+    if (result.good() && stack.top()->isElement())
++    if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          DcmElement *element = OFstatic_cast(DcmElement *, stack.top());
          if (element != NULL)
@@ -1392,7 +1348,7 @@ value representation.
    DcmStack stack;
    OFCondition result = item.search(DCM_MACIDNumber, stack, ESM_fromHere, OFFalse);
 -  if (result.good() && (stack.top()->isLeaf()))
-+  if (result.good() && (stack.top()->isElement()))
++  if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      result = ((DcmElement *)(stack.top()))->getUint16(macid);
    }
@@ -1401,7 +1357,7 @@ value representation.
    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()))
++    if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
        char *uid = NULL;
        if ((((DcmElement *)(stack.top()))->getString(uid)).good())
@@ -1410,7 +1366,7 @@ value representation.
    {
      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()))
++    if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
        OFString macidentifier;
        if ((((DcmElement *)(stack.top()))->getOFString(macidentifier, 0)).good())
@@ -1428,7 +1384,7 @@ value representation.
  
    // 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()))
++  if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      char *uid = NULL;
      if ((((DcmElement *)(stack.top()))->getString(uid)).good() && uid)
@@ -1437,7 +1393,7 @@ value representation.
  
    // 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 ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
    }
@@ -1446,7 +1402,7 @@ value representation.
  
    // 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 ((selectedSignatureItem->search(DCM_DigitalSignatureUID, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
    }
@@ -1455,7 +1411,7 @@ value representation.
  
    // 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 ((selectedSignatureItem->search(DCM_DigitalSignatureDateTime, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      if ((((DcmElement *)(stack.top()))->getOFString(str, 0)).good()) result = EC_Normal;
    }
@@ -1464,7 +1420,7 @@ value representation.
    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()))
++    if ((selectedMacParametersItem->search(DCM_MACCalculationTransferSyntaxUID, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
        char *uid = NULL;
        if ((((DcmElement *)(stack.top()))->getString(uid)).good())
@@ -1473,7 +1429,7 @@ value representation.
      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()))
++    if ((selectedMacParametersItem->search(DCM_MACAlgorithm, stack, ESM_fromHere, OFFalse)).good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
        OFString macidentifier;
        if ((((DcmElement *)(stack.top()))->getOFString(macidentifier, 0)).good())
@@ -1484,7 +1440,7 @@ value representation.
    DcmStack stack;
    result = item.search(DCM_CertificateType, stack, ESM_fromHere, OFFalse);
 -  if (result.good())
-+  if (result.good() && stack.top()->isElement())
++  if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
    {
      result = ((DcmElement *)(stack.top()))->getOFString(aString, 0);
      if (result.good())
@@ -1493,7 +1449,7 @@ value representation.
          stack.clear();
          result = item.search(DCM_CertificateOfSigner, stack, ESM_fromHere, OFFalse);
 -        if (result.good())
-+        if (result.good() && stack.top()->isElement())
++        if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
          {
            DcmElement *cert = (DcmElement *)stack.top();
            Uint8 *data = NULL;
@@ -1504,7 +1460,7 @@ value representation.
      const DcmTagKey tagKey = delem.getTag();
      OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
 -    if (result.good())
-+    if (result.good() && stack.top()->isElement())
++    if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          /* copy object from search stack */
          result = delem.copyFrom(*stack.top());
@@ -1513,7 +1469,7 @@ value representation.
      DcmStack stack;
      OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
 -    if (result.good())
-+    if (result.good() && stack.top()->isElement())
++    if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
      {
          DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
          /* we need a reference to the original element in order to determine the SpecificCharacterSet */


=====================================
debian/patches/0003-Fixed-wrong-error-handling-previous-commit.patch
=====================================
@@ -1,4 +1,4 @@
-From 2af7cec8378366e69f10c39550df69e8a37719d2 Mon Sep 17 00:00:00 2001
+From 9ecec7671ded01648354e617972d0f1f9a9576b9 Mon Sep 17 00:00:00 2001
 From: Joerg Riesmeier <dicom at jriesmeier.com>
 Date: Mon, 22 Apr 2024 12:11:11 +0200
 Subject: Fixed wrong error handling (previous commit).
@@ -17,12 +17,12 @@ Fixed wrong error handling introduced with the previous commit.
  {
      DcmStack stack;
      OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
--    if (result.good() && stack.top()->isElement())
+-    if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +    if (result.good())
      {
 -        DcmElement *element = OFstatic_cast(DcmElement *, stack.top());
 -        if (element != NULL)
-+        if (stack.top()->isElement())
++        if (dynamic_cast<DcmElement*>(stack.top()) != nullptr)
          {
 +            DcmElement *element = OFstatic_cast(DcmElement *, stack.top());
              if (checkElementValue(*element, vm, type, result, moduleName))
@@ -34,7 +34,7 @@ Fixed wrong error handling introduced with the previous commit.
      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() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +    if (result.good())
      {
 -        /* copy object from search stack */
@@ -42,7 +42,7 @@ Fixed wrong error handling introduced with the previous commit.
 -        /* 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())
++        if (dynamic_cast<DcmElement*>(stack.top()) != nullptr)
 +        {
 +            /* copy object from search stack */
 +            result = delem.copyFrom(*stack.top());
@@ -58,7 +58,7 @@ Fixed wrong error handling introduced with the previous commit.
  {
      DcmStack stack;
      OFCondition result = dataset.search(tagKey, stack, ESM_fromHere, OFFalse /*searchIntoSub*/);
--    if (result.good() && stack.top()->isElement())
+-    if (result.good() && (dynamic_cast<DcmElement*>(stack.top()) != nullptr))
 +    if (result.good())
      {
 -        DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
@@ -66,7 +66,7 @@ Fixed wrong error handling introduced with the previous commit.
 -        if (!checkElementValue(delem, tagKey, vm, type, result, moduleName, acceptViolation))
 -            result = SR_EC_InvalidValue;
 -        delem->getOFString(stringValue, 0);
-+        if (stack.top()->isElement())
++        if (dynamic_cast<DcmElement*>(stack.top()) != nullptr)
 +        {
 +            DcmElement *delem = OFstatic_cast(DcmElement *, stack.top());
 +            /* we need a reference to the original element in order to determine the SpecificCharacterSet */



View it on GitLab: https://salsa.debian.org/med-team/dcmtk/-/compare/e5c8d3e2432cb3a1b14fb459d99cc0894211bda2...d4ea45132c23e7ca992a5dcf0ec31cca1985d068

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/med-team/dcmtk/-/compare/e5c8d3e2432cb3a1b14fb459d99cc0894211bda2...d4ea45132c23e7ca992a5dcf0ec31cca1985d068
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20240624/1d9a2564/attachment-0001.htm>


More information about the debian-med-commit mailing list