Browse Source

Add check for App1 XMP marker length

pull/2077/head
James Jackson-South 4 years ago
parent
commit
d3936e2d3f
  1. 9
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

9
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -722,7 +722,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
if (ProfileResolver.IsProfile(this.temp, ProfileResolver.XmpMarker.Slice(0, ExifMarkerLength)))
{
int remainingXmpMarkerBytes = XmpMarkerLength - ExifMarkerLength;
const int remainingXmpMarkerBytes = XmpMarkerLength - ExifMarkerLength;
if (remaining < remainingXmpMarkerBytes || this.IgnoreMetadata)
{
// Skip the application header length.
stream.Skip(remaining);
return;
}
stream.Read(this.temp, ExifMarkerLength, remainingXmpMarkerBytes);
remaining -= remainingXmpMarkerBytes;
if (ProfileResolver.IsProfile(this.temp, ProfileResolver.XmpMarker))

Loading…
Cancel
Save