[Poppler-bugs] [Bug 103174] LZW decompression can fail

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Oct 10 08:30:38 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=103174

Adrian Johnson <ajohnson at redneon.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Adrian Johnson <ajohnson at redneon.com> ---
> But the compression is not per definition limited to this size.

Actually, it is. From the PDF spec:

"Codes shall never be longer than 12 bits; therefore, entry 4095 is the last
entry of the LZW table."

> I have seen PDF files with tables up to a size of 32k entries.

I'm surprised if this is the case. We output a specific error for this case and
no one has previously reported it. We handle up to 4096 for the benefit of PDF
generators that can't count.

Changing the size of the symbol table is not as simple as just changing the
array size. The code needs to modified to increase the symbol bit size as the
number of symbols increases. But the worst part is we can no longer copy the
uncompressed LZW stream when outputting to a PDF or PS file. The stream needs
to be uncompressed and recompressed to ensure our output conforms to the spec.
That will have a performance impact on every file just to fix the very rare
cases where the PDF is broken.

I'll leave it up to Albert to decide if he wants to change this.

In any case, we will need PDFs to test with. Preferably with a range of
different symbol table sizes that covers the powers of two.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20171010/7cc2b4a5/attachment.html>


More information about the Poppler-bugs mailing list