Skip to content

Commit

Permalink
- check if inside pixel_data
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlaka committed Nov 27, 2024
1 parent d151ae0 commit e7f5ae1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion parser/src/dataset/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,12 @@ where
Err(DecoderError::DecodeItemHeader {
source: dicom_encoding::decode::Error::ReadItemHeader { source, .. },
..
}) if source.kind() == std::io::ErrorKind::UnexpectedEof => {
}) if source.kind() == std::io::ErrorKind::UnexpectedEof
&& self.seq_delimiters.pop().map_or(false, |t| t.pixel_data)
=> {
// Note: if `UnexpectedEof` was reached while inside a
// PixelData Sequence, then we assume that
// the end of a DICOM object was reached gracefully.
self.hard_break = true;
None
}
Expand Down

0 comments on commit e7f5ae1

Please sign in to comment.