From 0f2b393c5ca77a44aa3489680ed2cac392e38757 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Fri, 13 May 2022 21:10:47 +0300 Subject: [PATCH 1/2] [GZip] Fix incorrect detection of truncated archives --- Sources/GZip/GzipArchive.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/GZip/GzipArchive.swift b/Sources/GZip/GzipArchive.swift index cb869e69..7a840402 100644 --- a/Sources/GZip/GzipArchive.swift +++ b/Sources/GZip/GzipArchive.swift @@ -77,8 +77,8 @@ public class GzipArchive: Archive { } private static func processMember(_ bitReader: LsbBitReader) throws -> Member { - // Valid GZip archive must contain at least 33 bytes of data. - guard bitReader.bitsLeft >= 33 * 8 + // Valid GZip archive must contain at least 18 bytes of data (10 for header and 8 for checksums). + guard bitReader.bitsLeft >= 18 * 8 else { throw GzipError.wrongMagic } let header = try GzipHeader(bitReader) From f72ed96e4834dc0c77be46de7b124fd103d36df6 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Fri, 13 May 2022 21:15:21 +0300 Subject: [PATCH 2/2] Prepare for 4.8.1 release --- .jazzy.yaml | 4 ++-- CHANGELOG.md | 4 ++++ SWCompression.podspec | 2 +- SWCompression.xcodeproj/SWCompression.plist | 4 ++-- SWCompression.xcodeproj/TestSWCompression.plist | 4 ++-- SWCompression.xcodeproj/project.pbxproj | 8 ++++---- Sources/swcomp/main.swift | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.jazzy.yaml b/.jazzy.yaml index 4e575e03..5c0b8bc5 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -3,11 +3,11 @@ sourcekitten_sourcefile: docs.json clean: false author: Timofey Solomko module: SWCompression -module_version: 4.8.0 +module_version: 4.8.1 copyright: '© 2022 Timofey Solomko' readme: README.md github_url: https://github.com/tsolomko/SWCompression -github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.8.0 +github_file_prefix: https://github.com/tsolomko/SWCompression/tree/4.8.1 theme: fullwidth custom_categories: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4767b08d..9e659cac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 4.8.1 + +- Fix incorrect detection of truncated GZip archives. + ## 4.8.0 - Added `TarReader` and `TarWriter` structs which allow more iterative work with TAR containers while helping with diff --git a/SWCompression.podspec b/SWCompression.podspec index 98c7507a..af4c11d7 100644 --- a/SWCompression.podspec +++ b/SWCompression.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "SWCompression" - s.version = "4.8.0" + s.version = "4.8.1" s.summary = "A framework with functions for working with compression, archives and containers." s.description = "A framework with (de)compression algorithms and functions for processing various archives and containers." diff --git a/SWCompression.xcodeproj/SWCompression.plist b/SWCompression.xcodeproj/SWCompression.plist index ec74bf5f..cd46feeb 100644 --- a/SWCompression.xcodeproj/SWCompression.plist +++ b/SWCompression.xcodeproj/SWCompression.plist @@ -15,9 +15,9 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.8.0 + 4.8.1 CFBundleVersion - 85 + 86 NSHumanReadableCopyright Copyright © 2022 Timofey Solomko diff --git a/SWCompression.xcodeproj/TestSWCompression.plist b/SWCompression.xcodeproj/TestSWCompression.plist index 4f5e43fb..b749e372 100644 --- a/SWCompression.xcodeproj/TestSWCompression.plist +++ b/SWCompression.xcodeproj/TestSWCompression.plist @@ -15,8 +15,8 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 4.8.0 + 4.8.1 CFBundleVersion - 85 + 86 diff --git a/SWCompression.xcodeproj/project.pbxproj b/SWCompression.xcodeproj/project.pbxproj index 0f4f6c98..4f559730 100644 --- a/SWCompression.xcodeproj/project.pbxproj +++ b/SWCompression.xcodeproj/project.pbxproj @@ -1512,7 +1512,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CURRENT_PROJECT_VERSION = 85; + CURRENT_PROJECT_VERSION = 86; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1593,7 +1593,7 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CURRENT_PROJECT_VERSION = 85; + CURRENT_PROJECT_VERSION = 86; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; "FRAMEWORK_SEARCH_PATHS[sdk=appletvos*]" = ( @@ -1654,7 +1654,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 85; + DYLIB_CURRENT_VERSION = 86; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -1681,7 +1681,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 85; + DYLIB_CURRENT_VERSION = 86; DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = SWCompression.xcodeproj/SWCompression.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; diff --git a/Sources/swcomp/main.swift b/Sources/swcomp/main.swift index b8340a45..78cc71ac 100644 --- a/Sources/swcomp/main.swift +++ b/Sources/swcomp/main.swift @@ -7,7 +7,7 @@ import Foundation import SWCompression import SwiftCLI -let cli = CLI(name: "swcomp", version: "4.8.0", +let cli = CLI(name: "swcomp", version: "4.8.1", description: """ swcomp - a small command-line client for SWCompression framework. Serves as an example of SWCompression usage.