pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] Bug in LZW filter?


From: Aleksander Morgado
Subject: Re: [pdf-devel] Bug in LZW filter?
Date: Sat, 03 Sep 2011 22:46:31 +0200

Hey Georg,

> 
> > Decoding this with pdf-filter outputs a different result as with pdfshow
> > (MuPDF). (the first 400 byte are equal but pdfshow is right as it shows
> > the full text)
> 
> In the decoder I think it is this sign error:
> 
> === modified file 'src/base/pdf-stm-f-lzw.c'
> --- src/base/pdf-stm-f-lzw.c    2011-08-29 15:34:31 +0000
> +++ src/base/pdf-stm-f-lzw.c    2011-09-02 15:58:50 +0000
> @@ -687,7 +687,7 @@
>            if (!lzwdec_put_decoded (st, out))
>              return PDF_STM_FILTER_APPLY_STATUS_NO_OUTPUT; /* No more
> output */
> 
> -          if (st->dict.size == st->buffer.maxval - 1 - st->early_change)
> +          if (st->dict.size == st->buffer.maxval + 1 - st->early_change)
>              {
>                lzw_buffer_inc_bitsize (&st->buffer);
>                /* break; We must wait for the reset code, don't reset
> yet. */
> 
> Did not thought that I find the error that fast. Sorry if you searched
> for it meanwhile.
> 
> A patch will follow.
> 

Great, good catch. Would it be possible to have some unit test for this
specific issue as well?

Cheers,

-- 
Aleksander

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]