Skip to content

Commit 7db3af9

Browse files
committed
BUG: Backport GDCM out-of-bounds fix
Back for of GDCM 5829c95c8ac3afa9a3a3413675e948959c28a789 Fix VU#591834.1 Original report is: Vulnerability VU#591834.1 (VU#591834) Date Added: 2025-08-21 Description: An out-of-bounds read vulnerability exists in the Grassroots DICOM library (GDCM), specifically within the SequenceOfFragments::ReadValue method. The issue is triggered during parsing of a malformed DICOM file containing encapsulated PixelData fragments (compressed image data stored as multiple fragments).
1 parent 01248b7 commit 7db3af9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition/gdcmSequenceOfFragments.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ std::istream& ReadValue(std::istream &is, bool /*readvalues*/)
237237
const size_t lastf = Fragments.size() - 1;
238238
const ByteValue *bv = Fragments[ lastf ].GetByteValue();
239239
const char *a = bv->GetPointer();
240-
gdcmAssertAlwaysMacro( (unsigned char)a[ bv->GetLength() - 3 ] == 0xfe );
240+
gdcmAssertAlwaysMacro( bv->GetLength() >= 3 && (unsigned char)a[ bv->GetLength() - 3 ] == 0xfe );
241241
Fragments[ lastf ].SetByteValue( bv->GetPointer(), bv->GetLength() - 3 );
242242
is.seekg( -11, std::ios::cur );
243243
assert( is.good() );

0 commit comments

Comments
 (0)