summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-10-19 17:46:00 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-10-19 17:46:00 (GMT)
commit29fa9d4d68af7d22b88545fa8bc4ae186d256fd3 (patch)
tree1f884092ef016b20bffeec3566e0323d82ddf221 /Lib/zipfile.py
parent1ef0c0349e8fdb5415e21231cb42edbf232b742a (diff)
downloadcpython-29fa9d4d68af7d22b88545fa8bc4ae186d256fd3.zip
cpython-29fa9d4d68af7d22b88545fa8bc4ae186d256fd3.tar.gz
cpython-29fa9d4d68af7d22b88545fa8bc4ae186d256fd3.tar.bz2
3.2 - 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