[poppler] Bug in JBIG2Stream
David Benjamin
davidben at MIT.EDU
Sun Jun 7 17:46:18 PDT 2009
Hi,
So, I've been tracking down a bug in JBIG2Stream. It fails to render
PDFs at [1] (second column) by misdetecting segments of incorrect length
(and then eats up useful bytes at line 1445). JBIG2Stream appears to
bypass FilterStream::str and uses it's own curStr[2], so getPos() is
wrong at the beginning.
Attached is a (trivial) patch to fix this. I'm not entirely sure if this
is the "correct" thing to do here; the current setup feels pretty iffy
anyway, but I get the feeling getPos() should not suddenly jump in the
middle of a stream? I don't really know poppler's code, so I'm not sure
what guarantees are Stream/FilterStream supposed to provide to users or
if they're exported API in the first place.
(At least internally in JBIG2Stream the only non-error-reporting use of
getPos is the segment-length-detection bit.)
[1] http://www.adobe.com/products/acrcapture/agentpack/index.html
[2] It seems to want to swap the stream out temporarily at reset()...
I'm not sure why; I'm unfamiliar with JBIG2.
David Benjamin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-jbig2stream-getpos.patch
Type: text/x-patch
Size: 866 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20090607/b662ee1f/attachment.bin
More information about the poppler
mailing list