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
Updated by Marco Eichelberg 11 months ago
- File sample2.dcm sample2.dcm added
- File sample1.dcm sample1.dcm added
Reported 2024-10-14 by DCMTK forum user Swanwa.Liao.
Updated by Marco Eichelberg 8 months ago
- Status changed from New to Closed
- Assignee set to Marco Eichelberg
- % Done changed from 0 to 100
- Estimated time set to 6:00 h
Closed by commit #99dade341 (public DCMTK) and #9ac7369ab (private modules).