Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: fixed regression in gdcmImageCodec.cxx
S. https://sourceforge.net/p/gdcm/bugs/554/ An unexpected behavior was introduced in commit 4ecd77a, causing pixel values being all greater or equal to zero on DICOM images where negative values are expected. When trying to solve the following cppcheck issues: shiftNegativeLHS,GDCM/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx:465,portability,Shifting a negative value is technically undefined behaviour shiftNegativeLHS,GDCM/Source/MediaStorageAndFileFormat/gdcmImageCodec.cxx:521,portability,Shifting a negative value is technically undefined behaviour The changes in gdcmImageCodec.cxx:465 and gdcmImageCodec.cxx:521 implies a potential difference in the sign of nmask, depending on the specific values of PF.GetBitsAllocated() and PF.GetBitsStored(). If the right shift operation in the modified version produces a non-negative value, the result will be positive, whereas the result in the non modified version will always be negative due to the initial assignment of 0x8000 as a signed integer.
- Loading branch information