Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/thirdparty/unrar/unpack15.cpp')
-rw-r--r--src/thirdparty/unrar/unpack15.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/thirdparty/unrar/unpack15.cpp b/src/thirdparty/unrar/unpack15.cpp
index 131d2665c..0bcb31454 100644
--- a/src/thirdparty/unrar/unpack15.cpp
+++ b/src/thirdparty/unrar/unpack15.cpp
@@ -401,6 +401,14 @@ void Unpack::GetFlagsBuf()
unsigned int Flags,NewFlagsPlace;
unsigned int FlagsPlace=DecodeNum(Inp.fgetbits(),STARTHF2,DecHf2,PosHf2);
+ // Our Huffman table stores 257 items and needs all them in other parts
+ // of code such as when StMode is on, so the first item is control item.
+ // While normally we do not use the last item to code the flags byte here,
+ // we need to check for value 256 when unpacking in case we unpack
+ // a corrupt archive.
+ if (FlagsPlace>=sizeof(ChSetC)/sizeof(ChSetC[0]))
+ return;
+
while (1)
{
Flags=ChSetC[FlagsPlace];