diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-01-21 06:23:44 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-01-21 06:23:44 (GMT) |
commit | c4032da2012d75c6c358f74d8bf9ee98a7fe8ecf (patch) | |
tree | d4b22fb30db4f03697789b0101453266041f4e83 /Modules | |
parent | ef9cf0835230398bb1af134eabaef7c3cad0bce3 (diff) | |
download | cpython-c4032da2012d75c6c358f74d8bf9ee98a7fe8ecf.zip cpython-c4032da2012d75c6c358f74d8bf9ee98a7fe8ecf.tar.gz cpython-c4032da2012d75c6c358f74d8bf9ee98a7fe8ecf.tar.bz2 |
prevent buffer overflow in get_data (closes #26171)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/zipimport.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 55bfb5d..83fa8f9 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1111,6 +1111,11 @@ get_data(PyObject *archive, PyObject *toc_entry) } file_offset += l; /* Start of file data */ + if (data_size > LONG_MAX - 1) { + fclose(fp); + PyErr_NoMemory(); + return NULL; + } bytes_size = compress == 0 ? data_size : data_size + 1; if (bytes_size == 0) bytes_size++; |