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