A sample code that can trigger the crash:
Code: Select all
DcmOtherByteOtherWord* pixelData = new DcmOtherByteOtherWord(DCM_PixelData);
uint16_t* p;
pixelData->createUint16Array(sliceSize, p);
The fix is below.
Code: Select all
diff -urEb dcmtk-3.6.3/dcmdata/libsrc/dcvrobow.cc dcmtk-3.6.3-patched/dcmdata/libsrc/dcvrobow.cc
--- dcmtk-3.6.3/dcmdata/libsrc/dcvrobow.cc 2018-02-05 17:58:12.000000000 +0000
+++ dcmtk-3.6.3-patched/dcmdata/libsrc/dcvrobow.cc 2018-09-12 09:42:34.810468538 +0100
@@ -379,7 +379,8 @@
Uint16 *&words)
{
/* check value representation */
- if ((getTag().getEVR() == EVR_OW) || (getTag().getEVR() == EVR_lt))
+ if ((getTag().getEVR() == EVR_OW) || (getTag().getEVR() == EVR_lt)
+ || (getTag().getEVR() == EVR_ox))
errorFlag = createEmptyValue(OFstatic_cast(Uint32, sizeof(Uint16) * OFstatic_cast(size_t, numWords)));
else
errorFlag = EC_CorruptedData;