Skip to content

Commit e9049e2

Browse files
Throw for unsupported App0 markers.
1 parent 145dc9e commit e9049e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,12 @@ private void ProcessApplicationHeaderMarker(BufferedReadStream stream, int remai
744744
}
745745

746746
stream.Read(this.temp, 0, JFifMarker.Length);
747-
remaining -= JFifMarker.Length;
747+
if (!JFifMarker.TryParse(this.temp, out this.jFif))
748+
{
749+
JpegThrowHelper.ThrowNotSupportedException("Unknown App0 Marker - Expected JFIF.");
750+
}
748751

749-
_ = JFifMarker.TryParse(this.temp, out this.jFif);
752+
remaining -= JFifMarker.Length;
750753

751754
// TODO: thumbnail
752755
if (remaining > 0)

0 commit comments

Comments
 (0)