]> 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 83fa8f932598abb9846e9da664cd176e64c97498..4594dd4f2f542d92e6d501b43241e8c684fd7944 100644 (file)
@@ -1071,6 +1071,10 @@ get_data(PyObject *archive, PyObject *toc_entry)
                           &date, &crc)) {
         return NULL;
     }
+    if (data_size < 0) {
+        PyErr_Format(ZipImportError, "negative data size");
+        return NULL;
+    }
 
     fp = _Py_fopen_obj(archive, "rb");
     if (!fp) {