Skip to content

Commit

Permalink
Throw a JpegError when a JPEG image has no frame data (issue 17302)
Browse files Browse the repository at this point in the history
Given that there's nothing to parse in this case, since we're dealing with an invalid JPEG image, throwing an *explicit* Error makes sense here.
  • Loading branch information
Snuffleupagus committed Nov 20, 2023
1 parent d8424a4 commit a6f0609
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/jpg.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,9 @@ class JpegImage {
offset += 2;
}

if (!frame) {
throw new JpegError("JpegImage.parse - no frame data found.");
}
this.width = frame.samplesPerLine;
this.height = frame.scanLines;
this.jfif = jfif;
Expand Down

0 comments on commit a6f0609

Please sign in to comment.