Bug 23025

Summary: Problem decoding JBIG2Stream stream
Product: poppler Reporter: Pedro Villavicencio <pvillavi>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: davidben
Version: unspecified   
Hardware: Other   
OS: All   
URL: https://bugs.edge.launchpad.net/ubuntu/+source/poppler/+bug/406594
Whiteboard:
i915 platform: i915 features:
Attachments: Correctly set the value of symCodeLen

Description Pedro Villavicencio 2009-07-29 13:38:10 UTC
this report has been filed here:

https://bugs.edge.launchpad.net/ubuntu/+source/poppler/+bug/406594

"1. Open "Failing pdf example" (attached) using evince. First page appears with 'next'.
2a. Press 'next' - "LOADING" appears, but nothing else. repeating 'next' -> same result.
OR
2b. Press 'next' - "LOADING" appears, but nothing else. press 'previous' -> first page appears OK
OR
2c. Use pull down magnification adjustment can result in hanging also. But using Control+ or Control- seem OK (though the result looks rather ragged!)

None of 2a,b, or c were expected behaviours.

Other pdfs open OK

Same example doc opens ok in Adobe Reader 9 version 9.1.2 for linux"

poppler version is 0.11.0

pdf: 

http://launchpadlibrarian.net/29677937/US20080229402.pdf
Comment 1 Albert Astals Cid 2009-07-30 13:52:33 UTC
The pdf has a stream we fail to decode properly and enter almost an infinite loop.
Comment 2 David Benjamin 2009-09-03 15:56:41 UTC
Created attachment 29194 [details] [review]
Correctly set the value of symCodeLen

JBIG2Stream had an off-by-one error. It was computing symCodeLen incorrectly. (1+floor vs ceil). This patch should fix it.

Did I mention this mistake was hard to find? I had the spec in one hand, JBIG2Stream.cc in the other...
Comment 3 David Benjamin 2009-09-03 16:02:30 UTC
Actually, should symCodeLen = 0 if they sum to 1? The spec doesn't say anything about it, but I suspect decoder->readBits(0) is going to be confused. Are they supposed to add up to always add to more? poppler should probably cleanly reject the file in that case.

Someone who actually knows how JBIG2 works?
Comment 4 Albert Astals Cid 2009-09-08 16:21:43 UTC
Well, you patch fixes 3 files and regresses none here so i'll take it as good for the moment. I've commited it so i'm closing the bug

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.