# HG changeset patch # User reimar # Date 1137243320 0 # Node ID 241b3a9bbd0cd989255c92a74db15f82e2b58491 # Parent 6a388c616fa34f52b70590fd596cc5fb58c3c862 Wrong state handling causing decompression errors in some cases diff -r 6a388c616fa3 -r 241b3a9bbd0c lzo.c --- a/lzo.c Sat Jan 14 03:39:02 2006 +0000 +++ b/lzo.c Sat Jan 14 12:55:20 2006 +0000 @@ -118,7 +118,6 @@ while (!c.error) { int cnt, back; if (x >> 4) { - state = BACKPTR; if (x >> 6) { cnt = (x >> 5) - 1; back = (get_byte(&c) << 3) + ((x >> 2) & 7) + 1; @@ -155,10 +154,9 @@ } copy_backptr(&c, back, cnt + 2); cnt = x & 3; + state = cnt ? BACKPTR : COPY; if (cnt) copy(&c, cnt); - else - state = (state == COPY) ? BACKPTR : COPY; x = get_byte(&c); } *inlen = c.in_end - c.in;