diff --git a/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs b/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs index 7f1f8023fe..2e92e9c76b 100644 --- a/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs +++ b/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs @@ -277,7 +277,9 @@ private WebpImageInfo ReadVp8XHeader() } else { - WebpThrowHelper.ThrowImageFormatException("Unexpected chunk followed VP8X header"); + // Ignore unknown chunks. + uint chunkSize = this.ReadChunkSize(); + this.currentStream.Skip((int)chunkSize); } } diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs index 275ff0b0fe..d3874a0511 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs @@ -358,6 +358,17 @@ public void WebpDecoder_CanDecode_Issue1594(TestImageProvider pr } } + // https://github.com/SixLabors/ImageSharp/issues/2243 + [Theory] + [WithFile(Lossy.Issue2243, PixelTypes.Rgba32)] + public void WebpDecoder_CanDecode_Issue2243(TestImageProvider provider) + where TPixel : unmanaged, IPixel + { + using Image image = provider.GetImage(WebpDecoder); + image.DebugSave(provider); + image.CompareToOriginal(provider, ReferenceDecoder); + } + [Theory] [WithFile(Lossless.LossLessCorruptImage3, PixelTypes.Rgba32)] public void WebpDecoder_ThrowImageFormatException_OnInvalidImages(TestImageProvider provider) diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 13f965a592..6510666a34 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -726,6 +726,7 @@ public static class Lossy // Issues public const string Issue1594 = "Webp/issues/Issue1594.webp"; + public const string Issue2243 = "Webp/issues/Issue2243.webp"; } } diff --git a/tests/Images/Input/Webp/issues/Issue2243.webp b/tests/Images/Input/Webp/issues/Issue2243.webp new file mode 100644 index 0000000000..2d1da9d980 --- /dev/null +++ b/tests/Images/Input/Webp/issues/Issue2243.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1aae55fae66f3f9469ad5e28eb8134a04b1c5d746acf0a4a19d0f63ca0581cd +size 55068