summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-10-19 17:52:41 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-10-19 17:52:41 (GMT)
commit7e3062b320a52f7b73751c432c33c1e46085de59 (patch)
tree782efcd6163394bd6d8c324f2e40f72e1b196708 /Lib/zipfile.py
parent294c231aa5a9b52fca429209c6091d44c8060008 (diff)
parent29fa9d4d68af7d22b88545fa8bc4ae186d256fd3 (diff)
downloadcpython-7e3062b320a52f7b73751c432c33c1e46085de59.zip
cpython-7e3062b320a52f7b73751c432c33c1e46085de59.tar.gz
cpython-7e3062b320a52f7b73751c432c33c1e46085de59.tar.bz2
default - Fix closes Issue6090 - Raise a ValueError, instead of failing with unrelated
exceptions, when a document with timestamp earlier than 1980 is provided to zipfile. Patch contributed by Petri Lehtinen.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 5cc7816..6ca269f 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -300,6 +300,10 @@ class ZipInfo (object):
self.filename = filename # Normalized file name
self.date_time = date_time # year, month, day, hour, min, sec
+
+ if date_time[0] < 1980:
+ raise ValueError('ZIP does not support timestamps before 1980')
+
# Standard values:
self.compress_type = ZIP_STORED # Type of compression for the file
self.comment = b"" # Comment for each file