43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
From 9749a73aaf1cbb4a46b730214f559fc8a6891597 Mon Sep 17 00:00:00 2001
|
|
From: Marco Eichelberg <eichelberg@offis.de>
|
|
Date: Thu, 23 Jan 2025 15:51:21 +0100
|
|
Subject: [PATCH] Fixed issue with invalid RLE compressed DICOM images.
|
|
|
|
Fixed issue when processing an RLE compressed image where the RLE header
|
|
contains an invalid stripe size.
|
|
|
|
Thanks to Ding zhengzheng <xiaozheng.ding399@gmail.com> for the report
|
|
and the sample file (PoC).
|
|
---
|
|
dcmdata/libsrc/dcrleccd.cc | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/dcmdata/libsrc/dcrleccd.cc b/dcmdata/libsrc/dcrleccd.cc
|
|
index fd01b63..e45ef0c 100644
|
|
--- a/dcmdata/libsrc/dcrleccd.cc
|
|
+++ b/dcmdata/libsrc/dcrleccd.cc
|
|
@@ -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
|
|
@@ -348,6 +348,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
|
|
--
|
|
2.48.1
|
|
|