blob: 177d1455f8846249c6bffa6a6618e57bd16ebbc6 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001p7zip: Fix CVE-2017-17969
2
3[No upstream tracking] -- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=888297
4
5Heap-based buffer overflow in 7zip
6
7Compress/ShrinkDecoder.cpp: Heap-based buffer overflow
8in the NCompress::NShrink::CDecoder::CodeReal method
9in 7-Zip before 18.00 and p7zip allows remote attackers
10to cause a denial of service (out-of-bounds write)
11or potentially execute arbitrary code via a crafted ZIP archive.
12
13Upstream-Status: Backport [https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/8316/attachment/CVE-2017-17969.patch]
14CVE: CVE-2017-17969
15Signed-off-by: Radovan Scasny <radovan.scasny@siemens.com>
16
17--- a/CPP/7zip/Compress/ShrinkDecoder.cpp
18+++ b/CPP/7zip/Compress/ShrinkDecoder.cpp
19@@ -121,7 +121,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
20 {
21 _stack[i++] = _suffixes[cur];
22 cur = _parents[cur];
23+ if (cur >= kNumItems || i >= kNumItems)
24+ break;
25 }
26+
27+ if (cur >= kNumItems || i >= kNumItems)
28+ break;
29
30 _stack[i++] = (Byte)cur;
31 lastChar2 = (Byte)cur;