Browse code

Fix CVE-2017-6419

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

suezzelur authored on 2018/05/23 03:00:48
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,28 @@
0
+diff -rup libmspack-0.5alpha/mspack/lzxd.c libmspack-0.5alpha-new/mspack/lzxd.c
1
+--- libmspack-0.5alpha/mspack/lzxd.c	2015-01-18 06:37:43.000000000 -0800
2
+@@ -766,6 +766,11 @@ int lzxd_decompress(struct lzxd_stream *
3
+       case LZX_BLOCKTYPE_UNCOMPRESSED:
4
+ 	/* as this_run is limited not to wrap a frame, this also means it
5
+ 	 * won't wrap the window (as the window is a multiple of 32k) */
6
++        if (window_posn + this_run > lzx->window_size) {
7
++                D(("match ran over window boundary"))
8
++                return lzx->error = MSPACK_ERR_DECRUNCH;
9
++        }
10
++
11
+ 	rundest = &window[window_posn];
12
+ 	window_posn += this_run;
13
+ 	while (this_run > 0) {
14
+@@ -888,8 +893,10 @@ void lzxd_free(struct lzxd_stream *lzx)
15
+   struct mspack_system *sys;
16
+   if (lzx) {
17
+     sys = lzx->sys;
18
+-    sys->free(lzx->inbuf);
19
+-    sys->free(lzx->window);
20
++    if(lzx->inbuf)
21
++        sys->free(lzx->inbuf);
22
++    if(lzx->window)
23
++        sys->free(lzx->window);
24
+     sys->free(lzx);
25
+   }
26
+ }
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        A library that provides compression and decompression of file formats used by Microsoft
2 2
 Name:           libmspack
3 3
 Version:        0.5alpha
4
-Release:        3%{?dist}
4
+Release:        4%{?dist}
5 5
 License:        LGPLv2+
6 6
 URL:            http://www.cabextract.org.uk/libmspack/libmspack-0.5alpha.tar.gz
7 7
 Group:          Applications/System
... ...
@@ -9,6 +9,7 @@ Vendor:         VMware, Inc.
9 9
 Distribution:   Photon
10 10
 Source0:        http://www.cabextract.org.uk/libmspack/%{name}-%{version}.tar.gz
11 11
 %define sha1    libmspack=226f19b1fc58e820671a1749983b06896e108cc4
12
+Patch0:         CVE-2017-6419.patch
12 13
 %description
13 14
 A library that provides compression and decompression of file formats used by Microsoft
14 15
 
... ...
@@ -20,6 +21,7 @@ It contains the libraries and header files to create applications.
20 20
 
21 21
 %prep
22 22
 %setup -q
23
+%patch0 -p1
23 24
 %build
24 25
 ./configure --prefix=/usr
25 26
 make %{?_smp_mflags}
... ...
@@ -45,6 +47,8 @@ cd test
45 45
 %{_libdir}/*.so
46 46
 
47 47
 %changelog
48
+*   Mon May 21 2018 Anish Swaminathan <anishs@vmware.com> 0.5alpha-4
49
+-   Patch for CVE-2017-6419
48 50
 *   Fri Jun 23 2017 Xiaolin Li <xiaolinl@vmware.com> 0.5alpha-3
49 51
 -   Add devel package.
50 52
 *   Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.5alpha-2