1*4882a593SmuzhiyunFrom 7f2da4f810b429ddb7afa0e252e3d02ced0eba87 Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Radovan Scasny <radovan.scasny@siemens.com> 3*4882a593SmuzhiyunDate: Tue, 20 Feb 2018 12:08:13 +0100 4*4882a593SmuzhiyunSubject: [PATCH] p7zip: Fix CVE-2017-17969 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun[No upstream tracking] -- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888297 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunHeap-based buffer overflow in 7zip 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunCompress/ShrinkDecoder.cpp: Heap-based buffer overflow 11*4882a593Smuzhiyunin the NCompress::NShrink::CDecoder::CodeReal method 12*4882a593Smuzhiyunin 7-Zip before 18.00 and p7zip allows remote attackers 13*4882a593Smuzhiyunto cause a denial of service (out-of-bounds write) 14*4882a593Smuzhiyunor potentially execute arbitrary code via a crafted ZIP archive. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunUpstream-Status: Backport [https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/8316/attachment/CVE-2017-17969.patch] 17*4882a593SmuzhiyunCVE: CVE-2017-17969 18*4882a593SmuzhiyunSigned-off-by: Radovan Scasny <radovan.scasny@siemens.com> 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun--- 21*4882a593Smuzhiyun CPP/7zip/Compress/ShrinkDecoder.cpp | 5 +++++ 22*4882a593Smuzhiyun 1 file changed, 5 insertions(+) 23*4882a593Smuzhiyun 24*4882a593Smuzhiyundiff --git a/CPP/7zip/Compress/ShrinkDecoder.cpp b/CPP/7zip/Compress/ShrinkDecoder.cpp 25*4882a593Smuzhiyunindex 80b7e67..5bb0559 100644 26*4882a593Smuzhiyun--- a/CPP/7zip/Compress/ShrinkDecoder.cpp 27*4882a593Smuzhiyun+++ b/CPP/7zip/Compress/ShrinkDecoder.cpp 28*4882a593Smuzhiyun@@ -121,7 +121,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * 29*4882a593Smuzhiyun { 30*4882a593Smuzhiyun _stack[i++] = _suffixes[cur]; 31*4882a593Smuzhiyun cur = _parents[cur]; 32*4882a593Smuzhiyun+ if (cur >= kNumItems || i >= kNumItems) 33*4882a593Smuzhiyun+ break; 34*4882a593Smuzhiyun } 35*4882a593Smuzhiyun+ 36*4882a593Smuzhiyun+ if (cur >= kNumItems || i >= kNumItems) 37*4882a593Smuzhiyun+ break; 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun _stack[i++] = (Byte)cur; 40*4882a593Smuzhiyun lastChar2 = (Byte)cur; 41