components/python/python27/patches/25-zipimport.patch
branchs11u3-sru
changeset 6185 0996b3bb223e
equal deleted inserted replaced
6180:a163ffb4ab14 6185:0996b3bb223e
       
     1 This patch comes from upstream:
       
     2 
       
     3 https://bugs.python.org/issue26171
       
     4 
       
     5 --- a/Modules/zipimport.c
       
     6 +++ b/Modules/zipimport.c
       
     7 @@ -895,6 +895,11 @@ get_data(char *archive, PyObject *toc_en
       
     8          PyMarshal_ReadShortFromFile(fp);        /* local header size */
       
     9      file_offset += l;           /* Start of file data */
       
    10  
       
    11 +    if (data_size > LONG_MAX - 1) {
       
    12 +        fclose(fp);
       
    13 +        PyErr_NoMemory();
       
    14 +        return NULL;
       
    15 +    }
       
    16      raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ?
       
    17                                            data_size : data_size + 1);
       
    18      if (raw_data == NULL) {