diff --git a/Modules/zipimport.c b/Modules/zipimport.c index fa60aa9e0a5..48a0f26f53d 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1091,6 +1091,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)