From 539a4dd28367fac8c9c8fec88ec9978f33b7f097 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Fri, 3 Feb 2012 22:02:25 -0800 Subject: [PATCH] Remove the dumb optimization. The "optimization" was to copy 8 bytes when a flag byte of all zero bits was read. But it was insufficiently clever and could lead to attempting to read past the end of the input. --- lzss3.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lzss3.py b/lzss3.py index d2f62de..d670fbd 100755 --- a/lzss3.py +++ b/lzss3.py @@ -47,11 +47,6 @@ def copybyte(): while len(data) < decompressed_size: b = readbyte() - if b == 0: - # dumb optimization - for _ in range(8): - copybyte() - continue flags = bits(b) for flag in flags: if flag == 0: @@ -89,11 +84,6 @@ def copybyte(): while len(data) < decompressed_size: b = readbyte() - if b == 0: - # dumb optimization - for _ in range(8): - copybyte() - continue flags = bits(b) for flag in flags: if flag == 0: