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