summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index ac17810..6773ea3 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -603,6 +603,9 @@ def decompress(data):
do = zlib.decompressobj(wbits=-zlib.MAX_WBITS)
# Read all the data except the header
decompressed = do.decompress(data[fp.tell():])
+ if not do.eof or len(do.unused_data) < 8:
+ raise EOFError("Compressed file ended before the end-of-stream "
+ "marker was reached")
crc, length = struct.unpack("<II", do.unused_data[:8])
if crc != zlib.crc32(decompressed):
raise BadGzipFile("CRC check failed")