Make sure we're not reading 0 bits in the lzw decompression loop -- this causes a hang

db4
Doug Coleman 2010-01-31 16:29:20 -06:00
parent c6b37f4da4
commit fa042f6578
1 changed files with 3 additions and 1 deletions

View File

@ -26,9 +26,11 @@ TUPLE: gif-lzw < lzw ;
dup end-of-information-code>> 1 + initial-uncompress-table >>table
dup initial-code-size>> >>code-size ;
ERROR: code-size-zero ;
: <lzw-uncompress> ( input code-size class -- obj )
new
swap >>code-size
swap [ code-size-zero ] when-zero >>code-size
dup code-size>> >>initial-code-size
dup code-size>> 1 - 2^ >>clear-code
dup clear-code>> 1 + >>end-of-information-code