File tree Expand file tree Collapse file tree 4 files changed +36
-8
lines changed
src/ImageSharp/Formats/Webp Expand file tree Collapse file tree 4 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -660,14 +660,22 @@ private uint ReadChunkSize()
660
660
/// </summary>
661
661
/// <param name="chunkType">The chunk type.</param>
662
662
/// <returns>True, if its an optional chunk type.</returns>
663
- private static bool IsOptionalVp8XChunk ( WebpChunkType chunkType ) => chunkType switch
663
+ private static bool IsOptionalVp8XChunk ( WebpChunkType chunkType )
664
664
{
665
- WebpChunkType . Alpha => true ,
666
- WebpChunkType . Animation => true ,
667
- WebpChunkType . Exif => true ,
668
- WebpChunkType . Iccp => true ,
669
- WebpChunkType . Xmp => true ,
670
- _ => false
671
- } ;
665
+ switch ( chunkType )
666
+ {
667
+ case WebpChunkType . Alpha :
668
+ case WebpChunkType . Iccp :
669
+ case WebpChunkType . Exif :
670
+ case WebpChunkType . Xmp :
671
+ return true ;
672
+ case WebpChunkType . AnimationParameter :
673
+ case WebpChunkType . Animation :
674
+ WebpThrowHelper . ThrowNotSupportedException ( "Animated webp are not yet supported." ) ;
675
+ return false ;
676
+ default :
677
+ return false ;
678
+ }
679
+ }
672
680
}
673
681
}
Original file line number Diff line number Diff line change 1
1
// Copyright (c) Six Labors.
2
2
// Licensed under the Apache License, Version 2.0.
3
3
4
+ using System ;
4
5
using System . IO ;
5
6
using SixLabors . ImageSharp . Formats . Webp ;
6
7
using SixLabors . ImageSharp . PixelFormats ;
@@ -369,6 +370,19 @@ public void WebpDecoder_ThrowImageFormatException_OnInvalidImages<TPixel>(TestIm
369
370
}
370
371
} ) ;
371
372
373
+ // https://github.com/SixLabors/ImageSharp/issues/2154
374
+ [ Theory ]
375
+ [ WithFile ( Lossless . Issue2154 , PixelTypes . Rgba32 ) ]
376
+ public void WebpDecoder_ThrowsNotSupportedException_Issue2154 < TPixel > ( TestImageProvider < TPixel > provider )
377
+ where TPixel : unmanaged, IPixel < TPixel > =>
378
+ Assert . Throws < NotSupportedException > (
379
+ ( ) =>
380
+ {
381
+ using ( provider . GetImage ( WebpDecoder ) )
382
+ {
383
+ }
384
+ } ) ;
385
+
372
386
#if SUPPORTS_RUNTIME_INTRINSICS
373
387
private static void RunDecodeLossyWithHorizontalFilter ( )
374
388
{
Original file line number Diff line number Diff line change @@ -632,6 +632,9 @@ public static class Lossless
632
632
public const string LossLessCorruptImage3 = "Webp/lossless_color_transform.webp" ; // cross_color, predictor
633
633
634
634
public const string LossLessCorruptImage4 = "Webp/near_lossless_75.webp" ; // predictor, cross_color.
635
+
636
+ // Issues
637
+ public const string Issue2154 = "Webp/issues/Issue2154.webp" ;
635
638
}
636
639
637
640
public static class Lossy
Original file line number Diff line number Diff line change
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df1160649539a1f73d4c52043358092c59c584763daf18007ff73b72865ddbc1
3
+ size 37342
You can’t perform that action at this time.
0 commit comments