dgobbi / vtk-dicom

A set of classes for using DICOM in VTK.
BSD 3-Clause "New" or "Revised" License
258 stars 94 forks source link

Zeros at end of file cause infinite loop #201

Closed dgobbi closed 3 years ago

dgobbi commented 3 years ago

VTK issue 18076 reports that trailing zeros on a DICOM file cause the vtkDICOMParser to go into an infinite loop. The loop referred to by the reporter (lines 2141-2257) is the main group-by-group reading loop of the parser, so the trailing zeros are probably causing the parser to fail to recognize the end of the file, while at the same causing the parser to fail to advance.

dgobbi commented 3 years ago

Fixed by commit 89ff8721. The fix causes the extra bytes to be ignored, rather than generating an error or warning. We want the parser to be tolerant of minor problems with the files in order to broaden compatibility.