Skip to content

Commit

Permalink
Merge pull request #607 from jmlaka/broken_pixel_data
Browse files Browse the repository at this point in the history
Broken pixel_data fix: support parsing improperly closed encapsulated pixel data
  • Loading branch information
Enet4 authored Dec 7, 2024
2 parents e81a438 + e7f5ae1 commit c4f57c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions parser/src/dataset/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,18 @@ where
}
}
}
Err(DecoderError::DecodeItemHeader {
source: dicom_encoding::decode::Error::ReadItemHeader { source, .. },
..
}) 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
}
Err(e) => {
self.hard_break = true;
Some(Err(e).context(ReadItemHeaderSnafu))
Expand Down

0 comments on commit c4f57c7

Please sign in to comment.