Skip to content

Commit

Permalink
Merge pull request image-rs#180 from image-rs/issue-image-1410-panic
Browse files Browse the repository at this point in the history
Issue image 1410 panic
  • Loading branch information
HeroicKatora authored Jan 27, 2021
2 parents b97ceaf + 59652e9 commit a6efabe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ impl<R: Read> Decoder<R> {
previous_marker = marker;
}

if self.frame.is_none() {
return Err(Error::Format("end of image encountered before frame".to_owned()));
}

let frame = self.frame.as_ref().unwrap();

// If we're decoding a progressive jpeg and a component is unfinished, render what we've got
Expand Down
1 change: 1 addition & 0 deletions tests/crashtest/images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ derive-huffman-codes-overflow.jpg | Found by Pascal Hertleif (@killercup) while
missing-sof.jpg | Found by Corey Farwell (@frewsxcv) when fuzz testing
extraneous-bytes-after-sos.jpg | Scan from brother DSmobile 920DW provided by Filip Lundborg (@filipl)
missing-sos.jpg | Generated in GIMP and manually edited by John Reynolds (@quilan1)
missing-frame-image-1410.jpg | Found by @frewsxcv when fuzzing
1 change: 1 addition & 0 deletions tests/crashtest/images/missing-frame-image-1410.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a6efabe

Please sign in to comment.