aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Stefani <luca.stefani.ge1@gmail.com>2018-08-22 18:56:50 +0200
committerLuca Stefani <luca.stefani.ge1@gmail.com>2018-08-22 18:56:50 +0200
commit0a45d8700f5e4307688eab7252c3a0598fac7ebf (patch)
tree8ed47476b12db01e5101bbd4b08cc99c11802d47
parent9d1f86e09814b88aa6165330410d8d2a9793a432 (diff)
downloadandroid_external_p7zip-0a45d8700f5e4307688eab7252c3a0598fac7ebf.tar.gz
android_external_p7zip-0a45d8700f5e4307688eab7252c3a0598fac7ebf.tar.bz2
android_external_p7zip-0a45d8700f5e4307688eab7252c3a0598fac7ebf.zip
Fix CVE-2017-17969
Change-Id: I467722e127b413d2f31e945e7f1b260ae6981b6f
-rw-r--r--CPP/7zip/Compress/ShrinkDecoder.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/CPP/7zip/Compress/ShrinkDecoder.cpp b/CPP/7zip/Compress/ShrinkDecoder.cpp
index 80b7e67..5bb0559 100644
--- a/CPP/7zip/Compress/ShrinkDecoder.cpp
+++ b/CPP/7zip/Compress/ShrinkDecoder.cpp
@@ -121,7 +121,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
{
_stack[i++] = _suffixes[cur];
cur = _parents[cur];
+ if (cur >= kNumItems || i >= kNumItems)
+ break;
}
+
+ if (cur >= kNumItems || i >= kNumItems)
+ break;
_stack[i++] = (Byte)cur;
lastChar2 = (Byte)cur;