@@ -35,7 +35,7 @@ public void CloneIsDeep()
3535 RepeatCount = 1 ,
3636 ColorTableMode = GifColorTableMode . Global ,
3737 GlobalColorTable = new [ ] { Color . Black , Color . White } ,
38- Comments = new List < string > { "Foo" }
38+ Comments = [ "Foo" ]
3939 } ;
4040
4141 GifMetadata clone = ( GifMetadata ) meta . DeepClone ( ) ;
@@ -126,7 +126,7 @@ public void Identify_VerifyRatio(string imagePath, int xResolution, int yResolut
126126 public async Task Identify_VerifyRatioAsync ( string imagePath , int xResolution , int yResolution , PixelResolutionUnit resolutionUnit )
127127 {
128128 TestFile testFile = TestFile . Create ( imagePath ) ;
129- using MemoryStream stream = new ( testFile . Bytes , false ) ;
129+ await using MemoryStream stream = new ( testFile . Bytes , false ) ;
130130 ImageInfo image = await GifDecoder . Instance . IdentifyAsync ( DecoderOptions . Default , stream ) ;
131131 ImageMetadata meta = image . Metadata ;
132132 Assert . Equal ( xResolution , meta . HorizontalResolution ) ;
@@ -152,7 +152,7 @@ public void Decode_VerifyRatio(string imagePath, int xResolution, int yResolutio
152152 public async Task Decode_VerifyRatioAsync ( string imagePath , int xResolution , int yResolution , PixelResolutionUnit resolutionUnit )
153153 {
154154 TestFile testFile = TestFile . Create ( imagePath ) ;
155- using MemoryStream stream = new ( testFile . Bytes , false ) ;
155+ await using MemoryStream stream = new ( testFile . Bytes , false ) ;
156156 using Image < Rgba32 > image = await GifDecoder . Instance . DecodeAsync < Rgba32 > ( DecoderOptions . Default , stream ) ;
157157 ImageMetadata meta = image . Metadata ;
158158 Assert . Equal ( xResolution , meta . HorizontalResolution ) ;
@@ -214,4 +214,24 @@ public void Identify_Frames(
214214 Assert . Equal ( frameDelay , gifFrameMetadata . FrameDelay ) ;
215215 Assert . Equal ( disposalMethod , gifFrameMetadata . DisposalMethod ) ;
216216 }
217+
218+ [ Theory ]
219+ [ InlineData ( TestImages . Gif . Issues . BadMaxLzwBits , 8 ) ]
220+ [ InlineData ( TestImages . Gif . Issues . Issue2012BadMinCode , 1 ) ]
221+ public void Identify_Frames_Bad_Lzw ( string imagePath , int framesCount )
222+ {
223+ TestFile testFile = TestFile . Create ( imagePath ) ;
224+ using MemoryStream stream = new ( testFile . Bytes , false ) ;
225+
226+ ImageInfo imageInfo = Image . Identify ( stream ) ;
227+
228+ Assert . NotNull ( imageInfo ) ;
229+ GifMetadata gifMetadata = imageInfo . Metadata . GetGifMetadata ( ) ;
230+ Assert . NotNull ( gifMetadata ) ;
231+
232+ Assert . Equal ( framesCount , imageInfo . FrameMetadataCollection . Count ) ;
233+ GifFrameMetadata gifFrameMetadata = imageInfo . FrameMetadataCollection [ imageInfo . FrameMetadataCollection . Count - 1 ] . GetGifMetadata ( ) ;
234+
235+ Assert . NotNull ( gifFrameMetadata ) ;
236+ }
217237}
0 commit comments