From 72eee72320c96caaad427aab6b6c638ca3f424df Mon Sep 17 00:00:00 2001 From: Bunny Wong Date: Tue, 16 Jun 2020 22:43:18 +0800 Subject: [PATCH] Break immediately when `inflate` exactly reaches the end of the buffer. --- Sources/Gzip/Data+Gzip.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Gzip/Data+Gzip.swift b/Sources/Gzip/Data+Gzip.swift index 1f9c6c5..53b935c 100644 --- a/Sources/Gzip/Data+Gzip.swift +++ b/Sources/Gzip/Data+Gzip.swift @@ -211,7 +211,7 @@ extension Data { stream.next_in = nil } - } while stream.avail_out == 0 + } while stream.avail_out == 0 && status != Z_STREAM_END guard deflateEnd(&stream) == Z_OK, status == Z_STREAM_END else { throw GzipError(code: status, msg: stream.msg)