Blame 00201-prevent-buffer-overflow-in-zipimport-module.patch

138d744
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
138d744
index 7240cb4..a139a3f 100644
138d744
--- a/Modules/zipimport.c
138d744
+++ b/Modules/zipimport.c
138d744
@@ -895,6 +895,11 @@ get_data(char *archive, PyObject *toc_entry)
138d744
         PyMarshal_ReadShortFromFile(fp);        /* local header size */
138d744
     file_offset += l;           /* Start of file data */
138d744
 
138d744
+    if (data_size > LONG_MAX - 1) {
138d744
+        fclose(fp);
138d744
+        PyErr_NoMemory();
138d744
+        return NULL;
138d744
+    }
138d744
     raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ?
138d744
                                           data_size : data_size + 1);
138d744
     if (raw_data == NULL) {