]> granicus.if.org Git - python/commitdiff
reject negative data_size
authorBenjamin Peterson <benjamin@python.org>
Fri, 22 Jan 2016 06:02:46 +0000 (22:02 -0800)
committerBenjamin Peterson <benjamin@python.org>
Fri, 22 Jan 2016 06:02:46 +0000 (22:02 -0800)
Modules/zipimport.c

index 006be3c59a85b08ef6b5aceedbc4ec854b92f4f0..be9753f1dd66de538cd3fa50889139c9510ddde3 100644 (file)
@@ -861,6 +861,10 @@ get_data(char *archive, PyObject *toc_entry)
                           &date, &crc)) {
         return NULL;
     }
+    if (data_size < 0) {
+        PyErr_Format(ZipImportError, "negative data size");
+        return NULL;
+    }
 
     fp = fopen(archive, "rb");
     if (!fp) {