Bug #1140
closedDcmElement::getUncompressedFrameSize() may return incorrect size
100%
Description
When DcmElement::getUncompressedFrameSize() calculates the frame size for a compressed image where BitsAllocated=12, then the calculated frame size will be based on 12 bits/sample, while the decoders will most likely change BitsAllocated to 16 and use a larger frame size. Therefore, a buffer based on the calculation made by DcmElement::getUncompressedFrameSize() will be too small, and a buffer overrun will occur. This only affects images that violate the DICOM rule that BitsAllocated must be either 1 or a multiple of 8, but still should not cause buffer overruns.
In cases where BitsAllocated is not 1, 8, 16 or 32, DcmElement::getUncompressedFrameSize() should probably use the next higher value as basis for the calculation. Special handling for BitsAllocated=1 may also be needed because some decoders will support this, and others will generate an image with 8 bits/pixel. Therefore, an overloaded version of the routine that takes into account the specific decoder might be required for compressed pixel data.
Files