Browse Source

ensure we consume stream when failing to read ICC profile

pull/241/head
Scott Williams 9 years ago
parent
commit
f097bcb278
  1. 7
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

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

@ -982,6 +982,7 @@ namespace ImageSharp.Formats
byte[] identifier = new byte[Icclength];
this.InputProcessor.ReadFull(identifier, 0, Icclength);
remaining -= Icclength; // we have read it by this point
if (identifier[0] == 'I' &&
identifier[1] == 'C' &&
@ -996,7 +997,6 @@ namespace ImageSharp.Formats
identifier[10] == 'E' &&
identifier[11] == '\0')
{
remaining -= Icclength;
byte[] profile = new byte[remaining];
this.InputProcessor.ReadFull(profile, 0, remaining);
@ -1009,6 +1009,11 @@ namespace ImageSharp.Formats
metadata.IccProfile.Extend(profile);
}
}
else
{
// not an ICC profile we can handle read the remaining so we can carry on and ignore this.
this.InputProcessor.Skip(remaining);
}
}
/// <summary>

Loading…
Cancel
Save