File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ class HuffDicDecompressor {
203203
204204 u32 codeLength = 0 ;
205205
206- Vec< u32 > recursionGuard ;
206+ int recursionDepth = 0 ;
207207
208208 public:
209209 HuffDicDecompressor ();
@@ -237,15 +237,16 @@ bool HuffDicDecompressor::DecodeOne(u32 code, str::Str& dst) {
237237 }
238238
239239 if (!(symLen & 0x8000 )) {
240- if (recursionGuard. Contains (code) ) {
240+ if (recursionDepth > 20 ) {
241241 logf (" infinite recursion\n " );
242242 return false ;
243243 }
244- recursionGuard. Append (code) ;
244+ recursionDepth++ ;
245245 if (!Decompress (p, symLen, dst)) {
246+ recursionDepth--;
246247 return false ;
247248 }
248- recursionGuard. Pop () ;
249+ recursionDepth-- ;
249250 } else {
250251 symLen &= 0x7fff ;
251252 if (symLen > 127 ) {
You can’t perform that action at this time.
0 commit comments