[Python-checkins] cpython (2.7): reject negative data_size

benjamin.peterson python-checkins at python.org
Fri Jan 22 01:04:13 EST 2016


https://hg.python.org/cpython/rev/2edbdb79cd6d
changeset:   100034:2edbdb79cd6d
branch:      2.7
parent:      100031:89a84ada27c5
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Jan 21 22:02:46 2016 -0800
summary:
  reject negative data_size

files:
  Modules/zipimport.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Modules/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -861,6 +861,10 @@
                           &date, &crc)) {
         return NULL;
     }
+    if (data_size < 0) {
+        PyErr_Format(ZipImportError, "negative data size");
+        return NULL;
+    }
 
     fp = fopen(archive, "rb");
     if (!fp) {

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list