diff options
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/filt_lzwd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fitz/filt_lzwd.c b/fitz/filt_lzwd.c index 3ee4d34c..b1aa4421 100644 --- a/fitz/filt_lzwd.c +++ b/fitz/filt_lzwd.c @@ -80,6 +80,12 @@ read_lzwd(fz_stream *stm, unsigned char *buf, int len) break; } + if (next_code >= NUM_CODES && code != LZW_CLEAR) + { + fz_warn(stm->ctx, "missing clear code in lzw decode"); + code = LZW_CLEAR; + } + if (code == LZW_CLEAR) { code_bits = MIN_BITS; @@ -112,7 +118,7 @@ read_lzwd(fz_stream *stm, unsigned char *buf, int len) { code_bits ++; if (code_bits > MAX_BITS) - code_bits = MAX_BITS; /* FIXME */ + code_bits = MAX_BITS; } old_code = code; |