]> gitweb.factorcode.org Git - factor.git/commitdiff
Make sure we're not reading 0 bits in the lzw decompression loop -- this causes a...
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Jan 2010 22:29:20 +0000 (16:29 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Jan 2010 22:29:20 +0000 (16:29 -0600)
basis/compression/lzw/lzw.factor

index e017636009b2f1546ec4f7cf89bba98fc635836e..340e4552917d8215305de92498ae23db097d364a 100644 (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