Skip to content

Commit ff16c65

Browse files
author
HeroicKatora
authored
Merge pull request #180 from image-rs/issue-image-1410-panic
Issue image 1410 panic
2 parents ee4fc87 + 7095d6b commit ff16c65

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/decoder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ impl<R: Read> Decoder<R> {
409409
previous_marker = marker;
410410
}
411411

412+
if self.frame.is_none() {
413+
return Err(Error::Format("end of image encountered before frame".to_owned()));
414+
}
415+
412416
let frame = self.frame.as_ref().unwrap();
413417

414418
// If we're decoding a progressive jpeg and a component is unfinished, render what we've got

tests/crashtest/images/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ derive-huffman-codes-overflow.jpg | Found by Pascal Hertleif (@killercup) while
77
missing-sof.jpg | Found by Corey Farwell (@frewsxcv) when fuzz testing
88
extraneous-bytes-after-sos.jpg | Scan from brother DSmobile 920DW provided by Filip Lundborg (@filipl)
99
missing-sos.jpg | Generated in GIMP and manually edited by John Reynolds (@quilan1)
10+
missing-frame-image-1410.jpg | Found by @frewsxcv when fuzzing
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)