Hi all,

I've just found a bug in PdfLZWFilter, and (maybe) developed a suitable fix. 
Please verify before using it :-)

Bug: parsing fails on some PDFs containing LZW-compressed streams (see also: 
"Problem with /LZWDecode filter stream" report as of of Fri, 16 Apr 2010 
10:02:06 -0700, this might solve the problem mentioned - had the same problem 
here).

Suggested solution: in file PdfFiltersPrivate.cpp, function 
PdfLZWFilter::DecodeBlockImpl, just remove the "case 4095:".

Reasons: when the dictionary size reaches 4095 entries, further incrementing 
m_mask will invariably lead to an "out of bounds" array access in s_masks[] 
(which has just four entries, valid indices 0..3). - In addition, at least the 
PDF files which I used for debugging do contain an PdfLZWFilter::s_clear as 
next opcode... but with unchanged m_code_len, so incrementing m_code_len will 
lead to consumption of an additional input bit, which will render the rest of 
the stream unreadable.

Regards,
Johannes


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to