diff --git a/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs b/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs index 4632200f4b..98a2805cd6 100644 --- a/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs +++ b/src/ImageSharp/Formats/Webp/WebpDecoderCore.cs @@ -221,7 +221,9 @@ private WebpImageInfo ReadVp8Info(bool ignoreAlpha = false) } 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 f5fd98f458..af709c0d86 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs @@ -385,6 +385,17 @@ public void WebpDecoder_CanDecode_Issue1594(TestImageProvider pr image.CompareToOriginal(provider, ReferenceDecoder); } + // 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 676d460e56..989776934f 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -736,6 +736,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