summaryrefslogtreecommitdiff
path: root/stream/filt_lzwd.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2008-08-18 23:47:00 +0200
committerSebastian Rasmussen <sebras@hotmail.com>2008-08-18 23:47:00 +0200
commit82b9202e64bbc919b0e3d54ad470c48d8fdb89fc (patch)
tree5c4ecd6a6ee0260e156dd8b1777f796a61ac64bd /stream/filt_lzwd.c
parent4bded2733a5e2d842df99a6ddaf8457d75f1ba8a (diff)
downloadmupdf-82b9202e64bbc919b0e3d54ad470c48d8fdb89fc.tar.xz
Properly take care of clear code in LZW decoder.
Diffstat (limited to 'stream/filt_lzwd.c')
-rw-r--r--stream/filt_lzwd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/stream/filt_lzwd.c b/stream/filt_lzwd.c
index 127ebde8..8e90a74e 100644
--- a/stream/filt_lzwd.c
+++ b/stream/filt_lzwd.c
@@ -176,15 +176,18 @@ fz_processlzwd(fz_filter *filter, fz_buffer *in, fz_buffer *out)
return fz_iodone;
}
+ eatbits(lzw, oldcodebits + MINBITS);
+
+ lzw->oldcode = lzw->code;
+
if (out->wp + 1 > out->ep)
+ {
+ lzw->resume = 1;
return fz_ioneedout;
+ }
*out->wp++ = lzw->code;
- lzw->oldcode = lzw->code;
-
- eatbits(lzw, oldcodebits + MINBITS);
-
continue;
}