Browse Source

Restore WebP ICC framing comments

pull/3187/head
James Jackson-South 3 weeks ago
parent
commit
584b662ffa
  1. 5
      src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs
  2. 5
      src/ImageSharp/Formats/Webp/WebpDecoderCore.cs

5
src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs

@ -381,6 +381,11 @@ internal class WebpAnimationDecoder : IDisposable
switch (chunkType) switch (chunkType)
{ {
case WebpChunkType.Iccp: case WebpChunkType.Iccp:
// While ICC profiles are optional, an invalid ICC profile cannot be ignored because it must
// precede the frame data, and we cannot safely skip it without successfully reading its size.
// ReadIccProfile therefore validates the complete chunk extent before invoking the ancillary
// handler. Only errors in the contents of a complete chunk follow that recovery policy.
WebpChunkParsingUtils.ReadIccProfile(stream, imageMetadata, ignoreMetadata, this.executeAncillarySegmentAction); WebpChunkParsingUtils.ReadIccProfile(stream, imageMetadata, ignoreMetadata, this.executeAncillarySegmentAction);
break; break;
case WebpChunkType.Exif: case WebpChunkType.Exif:

5
src/ImageSharp/Formats/Webp/WebpDecoderCore.cs

@ -285,6 +285,11 @@ internal sealed class WebpDecoderCore : ImageDecoderCore, IDisposable
switch (chunkType) switch (chunkType)
{ {
case WebpChunkType.Iccp: case WebpChunkType.Iccp:
// While ICC profiles are optional, an invalid ICC profile cannot be ignored because it must
// precede the image data, and we cannot safely skip it without successfully reading its size.
// ReadIccProfile therefore validates the complete chunk extent before invoking the ancillary
// handler. Only errors in the contents of a complete chunk follow that recovery policy.
WebpChunkParsingUtils.ReadIccProfile(stream, metadata, ignoreMetadata, this.ExecuteAncillarySegmentAction); WebpChunkParsingUtils.ReadIccProfile(stream, metadata, ignoreMetadata, this.ExecuteAncillarySegmentAction);
break; break;

Loading…
Cancel
Save