From 69f1d3a1ca669945421537f1c6c68e56813cec3c Mon Sep 17 00:00:00 2001 From: "Eevee (Lexy Munroe)" Date: Fri, 23 Jun 2017 13:30:53 -0700 Subject: [PATCH] I swear to god this compression thing will be the death of me --- pokedex/extract/lib/garc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokedex/extract/lib/garc.py b/pokedex/extract/lib/garc.py index bf8c0ae..7b7769e 100644 --- a/pokedex/extract/lib/garc.py +++ b/pokedex/extract/lib/garc.py @@ -95,7 +95,7 @@ class GARCEntry(object): start, length = self.slices[i] ss = self.stream.slice(start, length) peek = ss.peek(1) - if peek == b'\x11': + if peek == b'\x11' and length >= 128: from .compressed import DecompressionError, LZSS11CompressedStream decompressor = LZSS11CompressedStream(ss) try: @@ -106,7 +106,7 @@ class GARCEntry(object): return ss else: return decompressor - elif ss.peek(1) in b'\x10\x11': + elif ss.peek(1) in b'\x10\x11' and length >= 128: # XXX this sucks but there's no real way to know for sure whether # data is compressed or not. maybe just bake this into the caller # and let them deal with it, same way we do with text decoding?