@mihail.isakov I like your analysis ! Here is mine. The following attribute does not make much sense indeed:
(0028,1053) DS [-1024 ] # 6,1 Rescale Slope
If you look carefully a second attribute is actually send in the DataSet:
(0028,1053) DS [1 ] # 6,1 Rescale Slope
Since both GDCM & DCMTK uses the same convention: preserve the first one, the second one is actually never seen. So indeed the bug is indeed coming from the vendor machine, which send a Rescale Slope attribute in place of a Rescale Intercept.
As a side note, in this particular DataSet, the PixelData is already in the correct unit. So I believe the correct Attributes are:
(0028,1052) DS [0 ] # 6,1 Rescale Intercept
(0028,1053) DS [1 ] # 6,1 Rescale Slope
For reference here is a truncated output of dcdump
(dicom3tools):
[...]
|(0x0028,0x1050) DS Window Center | VR=<DS> VL=<0x0004> <-400> |
|(0x0028,0x1051) DS Window Width | VR=<DS> VL=<0x0004> <1500> |
|(0x0028,0x1053) DS Rescale Slope | VR=<DS> VL=<0x0002> <1 > |
|(0x0028,0x1053) DS Rescale Slope | VR=<DS> VL=<0x0006> <-1024 > |
|(0x7fe0,0x0010) OX Pixel Data | VR=<OW> VL=<0x80000>|
[...]
(I do not know why the attributes are being printed in opposite order of the file order)
In any cases, GDCM codebase should not trigger a heap buffer overflow. I’ll add a guard against this case.