@@ -35,7 +35,7 @@ public void CloneIsDeep()
35
35
RepeatCount = 1 ,
36
36
ColorTableMode = GifColorTableMode . Global ,
37
37
GlobalColorTable = new [ ] { Color . Black , Color . White } ,
38
- Comments = new List < string > { "Foo" }
38
+ Comments = [ "Foo" ]
39
39
} ;
40
40
41
41
GifMetadata clone = ( GifMetadata ) meta . DeepClone ( ) ;
@@ -126,7 +126,7 @@ public void Identify_VerifyRatio(string imagePath, int xResolution, int yResolut
126
126
public async Task Identify_VerifyRatioAsync ( string imagePath , int xResolution , int yResolution , PixelResolutionUnit resolutionUnit )
127
127
{
128
128
TestFile testFile = TestFile . Create ( imagePath ) ;
129
- using MemoryStream stream = new ( testFile . Bytes , false ) ;
129
+ await using MemoryStream stream = new ( testFile . Bytes , false ) ;
130
130
ImageInfo image = await GifDecoder . Instance . IdentifyAsync ( DecoderOptions . Default , stream ) ;
131
131
ImageMetadata meta = image . Metadata ;
132
132
Assert . Equal ( xResolution , meta . HorizontalResolution ) ;
@@ -152,7 +152,7 @@ public void Decode_VerifyRatio(string imagePath, int xResolution, int yResolutio
152
152
public async Task Decode_VerifyRatioAsync ( string imagePath , int xResolution , int yResolution , PixelResolutionUnit resolutionUnit )
153
153
{
154
154
TestFile testFile = TestFile . Create ( imagePath ) ;
155
- using MemoryStream stream = new ( testFile . Bytes , false ) ;
155
+ await using MemoryStream stream = new ( testFile . Bytes , false ) ;
156
156
using Image < Rgba32 > image = await GifDecoder . Instance . DecodeAsync < Rgba32 > ( DecoderOptions . Default , stream ) ;
157
157
ImageMetadata meta = image . Metadata ;
158
158
Assert . Equal ( xResolution , meta . HorizontalResolution ) ;
@@ -214,4 +214,24 @@ public void Identify_Frames(
214
214
Assert . Equal ( frameDelay , gifFrameMetadata . FrameDelay ) ;
215
215
Assert . Equal ( disposalMethod , gifFrameMetadata . DisposalMethod ) ;
216
216
}
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
+ }
217
237
}
0 commit comments