Skip to content

Commit fbfcc97

Browse files
author
Remo Gloor
committed
Check the entry.CompressionMethod in addition to the entry.CompressionMethodForHeader
1 parent 9989b3f commit fbfcc97

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/ICSharpCode.SharpZipLib/Zip/ZipInputStream.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,22 @@ public bool CanDecompressEntry
138138
/// <summary>
139139
/// Is the compression method for the specified entry supported?
140140
/// </summary>
141-
/// <remarks>
142-
/// Uses entry.CompressionMethodForHeader so that entries of type WinZipAES will be rejected.
143-
/// </remarks>
144141
/// <param name="entry">the entry to check.</param>
145142
/// <returns>true if the compression methiod is supported, false if not.</returns>
146143
private static bool IsEntryCompressionMethodSupported(ZipEntry entry)
147144
{
148-
var entryCompressionMethod = entry.CompressionMethodForHeader;
149-
150-
return entryCompressionMethod == CompressionMethod.Deflated ||
151-
entryCompressionMethod == CompressionMethod.Stored ||
152-
entryCompressionMethod == CompressionMethod.WinZipAES;
145+
var entryCompressionMethodForHeader = entry.CompressionMethodForHeader;
146+
var entryCompressionMethod = entry.CompressionMethod;
147+
148+
var compressionMethodSupported =
149+
entryCompressionMethod == CompressionMethod.Deflated ||
150+
entryCompressionMethod == CompressionMethod.Stored;
151+
var entryCompressionMethodForHeaderSupported =
152+
entryCompressionMethodForHeader == CompressionMethod.Deflated ||
153+
entryCompressionMethodForHeader == CompressionMethod.Stored ||
154+
entryCompressionMethodForHeader == CompressionMethod.WinZipAES;
155+
156+
return compressionMethodSupported && entryCompressionMethodForHeaderSupported;
153157
}
154158

155159
/// <summary>

0 commit comments

Comments
 (0)