Allow versionNeededToExtract between 0 and 20 in Zip impl.

In the Android eco-system, there are jars with entries with a
versionNeededToExtract of 0. That should probably have been 10,
but will be hard to fix. This change proposes to just check
that the versionNeededToExtract is between 0 and 20.
This commit is contained in:
Mads Ager
2022-02-07 12:17:11 +01:00
committed by teamcity
parent 76672a4abf
commit 66bf5b08ba
@@ -107,7 +107,10 @@ fun MappedByteBuffer.parseCentralDirectory(): List<ZipEntryDescription> {
currentOffset += 46 + fileNameLength + extraLength + fileCommentLength
require(versionNeededToExtract == 10 || versionNeededToExtract == 20) {
// We support version needed to extract 10 and 20. However, there are zip
// files in the eco-system with entries with invalid version to extract
// of 0. Therefore, we just check that the version is between 0 and 20.
require(0 <= versionNeededToExtract && versionNeededToExtract <= 20) {
"Unexpected versionNeededToExtract ($versionNeededToExtract) at $name"
}