From 5640bbb6c5c0c9232fd761ef4544687f9123e43e Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 21 Jan 2016 22:02:46 -0800 Subject: [PATCH] reject negative data_size --- Modules/zipimport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 006be3c59a8..be9753f1dd6 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -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) {