Project

General

Profile

Actions

Bug #1140

closed

DcmElement::getUncompressedFrameSize() may return incorrect size

Added by Marco Eichelberg 11 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Category:
Library and Apps
Target version:
Start date:
2024-10-15
Due date:
% Done:

100%

Estimated time:
6:00 h
Module:
Operating System:
Compiler:

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

sample2.dcm (607 KB) sample2.dcm compressed sample file demonstrating the issue Marco Eichelberg, 2024-10-15 10:05
sample1.dcm (607 KB) sample1.dcm compressed sample file demonstrating the issue Marco Eichelberg, 2024-10-15 10:05
Actions

Also available in: Atom PDF