Browse code

Add patch for python CVE-2016-5636

Change-Id: I9f3845d2498b945a2ffc05ceaf8c903638d3bf06
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1599
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George

suezzelur authored on 2016/10/28 11:36:26
Showing 4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+# HG changeset patch
1
+# User Benjamin Peterson <benjamin@python.org>
2
+# Date 1453357424 28800
3
+# Node ID 985fc64c60d6adffd1138b6cc46df388ca91ca5d
4
+# Parent  7ec954b9fc54448a35b56d271340ba109eb381b9
5
+prevent buffer overflow in get_data (closes #26171)
6
+ 
7
+diff --git a/Modules/zipimport.c b/Modules/zipimport.c
8
+--- a/Modules/zipimport.c
9
+@@ -895,6 +895,11 @@ get_data(char *archive, PyObject *toc_en
10
+         PyMarshal_ReadShortFromFile(fp);        /* local header size */
11
+     file_offset += l;           /* Start of file data */
12
+ 
13
++    if (data_size > LONG_MAX - 1) {
14
++        fclose(fp);
15
++        PyErr_NoMemory();
16
++        return NULL;
17
++    }
18
+     raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ?
19
+                                           data_size : data_size + 1);
20
+     if (raw_data == NULL) {
21
+
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	A high-level scripting language
2 2
 Name:		python2
3 3
 Version:	2.7.11
4
-Release:	7%{?dist}
4
+Release:	8%{?dist}
5 5
 License:	PSF
6 6
 URL:		http://www.python.org/
7 7
 Group:		System Environment/Programming
... ...
@@ -12,6 +12,7 @@ Source0:	http://www.python.org/ftp/python/2.7.11/Python-%{version}.tar.xz
12 12
 Patch0: cgi.patch
13 13
 Patch1: added-compiler-flags-for-curses-module.patch
14 14
 Patch2: added-pyopenssl-ipaddress-certificate-validation.patch
15
+Patch3: python2-CVE-2016-5636.patch
15 16
 BuildRequires:	pkg-config >= 0.28
16 17
 BuildRequires:	bzip2-devel
17 18
 BuildRequires:  openssl-devel
... ...
@@ -101,6 +102,8 @@ to build python programs.
101 101
 %patch0 -p1
102 102
 %patch1 -p1
103 103
 %patch2 -p1
104
+%patch3 -p1
105
+
104 106
 %build
105 107
 export OPT="${CFLAGS}"
106 108
 ./configure \
... ...
@@ -217,6 +220,8 @@ rm -rf %{buildroot}/*
217 217
 %{_bindir}/idle*
218 218
 
219 219
 %changelog
220
+*   Thu Oct 27 2016 Anish Swaminathan <anishs@vmware.com> 2.7.11-8
221
+-   Patch for CVE-2016-5636
220 222
 *   Wed Sep 14 2016 Divya Thaluru <dthaluru@vmware.com> 2.7.11-7
221 223
 -   Improvised pyopenssl patch
222 224
 *   Wed Sep 7 2016 Divya Thaluru <dthaluru@vmware.com> 2.7.11-6
223 225
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+# HG changeset patch
1
+# User Benjamin Peterson <benjamin@python.org>
2
+# Date 1453357506 28800
3
+# Node ID 10dad6da1b28ea4af78ad9529e469fdbf4ebbc8f
4
+# Parent  a3ac2cd93db9d5336dfd7b5b27efde2c568d8794# Parent  01ddd608b85c85952537d95a43bbabf4fb655057
5
+ 
6
+diff --git a/Modules/zipimport.c b/Modules/zipimport.c
7
+--- a/Modules/zipimport.c
8
+@@ -1127,6 +1127,11 @@ get_data(PyObject *archive, PyObject *to
9
+     }
10
+     file_offset += l;           /* Start of file data */
11
+ 
12
++    if (data_size > LONG_MAX - 1) {
13
++        fclose(fp);
14
++        PyErr_NoMemory();
15
++        return NULL;
16
++    }
17
+     bytes_size = compress == 0 ? data_size : data_size + 1;
18
+     if (bytes_size == 0)
19
+         bytes_size++;
20
+
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	A high-level scripting language
2 2
 Name:		python3
3 3
 Version:	3.5.1
4
-Release:	5%{?dist}
4
+Release:	6%{?dist}
5 5
 License:	PSF
6 6
 URL:		http://www.python.org/
7 7
 Group:		System Environment/Programming
... ...
@@ -9,7 +9,8 @@ Vendor:		VMware, Inc.
9 9
 Distribution:	Photon
10 10
 Source0:	https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz
11 11
 %define sha1 Python=0186da436db76776196612b98bb9c2f76acfe90e
12
-Patch:          cgi3.patch
12
+Patch0:         cgi3.patch
13
+Patch1:         python3-CVE-2016-5636.patch
13 14
 BuildRequires:	pkg-config >= 0.28
14 15
 BuildRequires:	bzip2-devel
15 16
 BuildRequires:	ncurses-devel
... ...
@@ -83,7 +84,8 @@ to build python programs.
83 83
 
84 84
 %prep
85 85
 %setup -q -n Python-%{version}
86
-%patch -p1
86
+%patch0 -p1
87
+%patch1 -p1
87 88
 
88 89
 %build
89 90
 export OPT="${CFLAGS}"
... ...
@@ -186,6 +188,8 @@ rm -rf %{buildroot}/*
186 186
 %{_bindir}/idle*
187 187
 
188 188
 %changelog
189
+*   	Thu Oct 27 2016 Anish Swaminathan <anishs@vmware.com> 3.5.1-6
190
+-   	Patch for CVE-2016-5636
189 191
 *	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 3.5.1-5
190 192
 -	GA - Bump release of all rpms
191 193
 *	Wed May 04 2016 Anish Swaminathan <anishs@vmware.com> 3.5.1-4