[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pdf-devel] Bug in LZW filter?
From: |
Georg Gottleuber |
Subject: |
Re: [pdf-devel] Bug in LZW filter? |
Date: |
Thu, 27 Oct 2011 11:39:20 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.20) Gecko/20111001 Lightning/1.0b2 Lanikai/3.1.12 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
On 11.10.2011 23:16, Aleksander Morgado wrote:
>> Changes sorted by line number (as in patch):
>> > [3]:
>> > -#define LZW_MAX_DICTSIZE (1 << LZW_MAX_BITSIZE)
>> > +#define LZW_MAX_DICTSIZE ((1 << LZW_MAX_BITSIZE) + 1)
>> > #define LZW_NULL_INDEX ~0U
>> > --------------------------------------------------------------------
> I really don't get this +1. I understand that currently the code needs
> the extra size, or we will write out of bounds, but the logic tells me
> that it shouldn't. The maximum size of the dictionary will be (should
> be) 212 = 4096, so therefore the fix is not to have the +1, but to try
> to avoid writing 4097 items.
this is also caused by the 1)3)2)-order (see my earlier mail). The
regular algorithm resets the dictionary before adding entry 4097. It
outputs a code that we output after reset. With +1 the output gets right.
But don't we miss a dictionary entry? (last one in old dict (#4097),
that should be in the new dict) Maybe this is a bug.
Regards,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk6pJsgACgkQ5sLITM1qIaJFpgCggo+GURBHpLXw+XzcKYae5ybX
JJAAmQHV99vHyow84EsrUFAifrCr5Ulo
=PMVO
-----END PGP SIGNATURE-----