Skip to content

Commit

Permalink
Fixed issue with invalid RLE compressed DICOM images.
Browse files Browse the repository at this point in the history
Fixed issue when processing an RLE compressed image where the RLE header
contains an invalid stripe size.

Thanks to Ding zhengzheng <[email protected]> for the report
and the sample file (PoC).
  • Loading branch information
eichelberg committed Jan 23, 2025
1 parent ffe976f commit bffa3e9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dcmdata/libsrc/dcrleccd.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2002-2024, OFFIS e.V.
* Copyright (C) 2002-2025, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -362,6 +362,12 @@ OFCondition DcmRLECodecDecoder::decode(
} /* while */

// last fragment for this RLE stripe
if (inputBytes + byteOffset > fragmentLength)
{
DCMDATA_ERROR("stream size in RLE header is wrong");
inputBytes = fragmentLength-byteOffset;
}

result = rledecoder.decompress(rleData + byteOffset, OFstatic_cast(size_t, inputBytes));

// special handling for zero pad byte at the end of the RLE stream
Expand Down

0 comments on commit bffa3e9

Please sign in to comment.