mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
[GZip] Adjust detection of truncated inputs
This commit is contained in:
@@ -77,8 +77,9 @@ public class GzipArchive: Archive {
|
||||
}
|
||||
|
||||
private static func processMember(_ bitReader: LsbBitReader) throws -> Member {
|
||||
// Valid GZip archive must contain at least 18 bytes of data (10 for header and 8 for checksums).
|
||||
guard bitReader.bitsLeft >= 18 * 8
|
||||
// Valid GZip archive must contain at least 20 bytes of data (10 for the header, 2 for an empty Deflate block,
|
||||
// and 8 for checksums).
|
||||
guard bitReader.bitsLeft >= 20 * 8
|
||||
else { throw GzipError.wrongMagic }
|
||||
|
||||
let header = try GzipHeader(bitReader)
|
||||
|
||||
Reference in New Issue
Block a user