Skip to content

Commit

Permalink
Remove the dumb optimization.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
magical committed Feb 4, 2012
1 parent 77019d1 commit 539a4dd
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions lzss3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 539a4dd

Please sign in to comment.