File tree 1 file changed +37
-0
lines changed
test/ICSharpCode.SharpZipLib.Tests/Zip
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . IO ;
3
+ using System . Text ;
4
+ using System . Threading ;
5
+ using ICSharpCode . SharpZipLib ;
6
+ using ICSharpCode . SharpZipLib . Zip ;
7
+ using NUnit . Framework ;
8
+
9
+ namespace ICSharpCode . SharpZipLib . Tests . Zip
10
+ {
11
+ public class ZipCorruptionHandling
12
+ {
13
+
14
+ const string TestFileZeroCodeLength = "UEsDBBQA+AAIANwyZ0U5T8HwjQAAAL8AAAAIABUAbGltZXJpY2t" +
15
+ "VVAkAAzBXXFR6LmBUVXgEAPQB9AEFjTEOwjAQBHu/YkVDg3gHoUaivjgHtmKfI5+D5d9zbndHM6/AldFJQTIJ" +
16
+ "PrVkPOkgce9QlJFi5hr9rhD+cUUvZ9qgnuRuBAtId97Qw0AL1Kbw5h6MykeKdlyWdlWs7OlUdgsodRqKVo0v8" +
17
+ "JWyGWZ6mLpuiii2t2Bl0mZ54QksOIpqXNPATF/eH1BLAQIXAxQAAgAIANxQZ0U5T8HwjQAAAL8AAAAIAA0AAA" +
18
+ "AAAAEAAACggQAAAABsaW1lcgEAQwAAAMgAAAAAAA==" ;
19
+
20
+ [ Test ]
21
+ [ Category ( "Zip" ) ]
22
+ [ MaxTime ( 5000 ) ]
23
+ public void ZeroCodeLengthZipFile ( )
24
+ {
25
+ Assert . Throws < SharpZipBaseException > ( ( ) => {
26
+ var fileBytes = Convert . FromBase64String ( TestFileZeroCodeLength ) ;
27
+ using ( var ms = new MemoryStream ( fileBytes ) )
28
+ using ( var zip = new ZipInputStream ( ms ) )
29
+ {
30
+ while ( zip . GetNextEntry ( ) != null ) { }
31
+ }
32
+ } ) ;
33
+ }
34
+
35
+ }
36
+
37
+ }
You can’t perform that action at this time.
0 commit comments