Bug 54579

Summary: File not renderer correctly (letters seem too gray when compared with Adobe Reader)
Product: poppler Reporter: Steven Lee <alitraffic007>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: the PDF that fire the bug.
SDNUMEXSYMS is allowed to be 0!

Description Steven Lee 2012-09-06 01:29:35 UTC
Created attachment 66702 [details]
the PDF that fire the bug.

When open the attached PDF document, tricky.pdf, I got the following message,

"Error (1495): Too many input symbols in JBIG2 symbol dictionary"
"Error (1495): Unexpected EOF in JBIG2 stream"

I tried it in mupdf/Adobe Reader, both work fine.
I think it is a bug of Poppler
Comment 1 Thomas Freitag 2012-09-07 11:57:02 UTC
As far as I can see the problem was introduced by commit ed0c9640abcbea459e3a276ee0b27631b01c32c4 (from 8th of April). Instead of

  bitmaps = (JBIG2Bitmap **)gmallocn_checkoverflow(numInputSyms + numNewSyms,
				     sizeof(JBIG2Bitmap *));
  if (!bitmaps) {

it should be 

  bitmaps = (JBIG2Bitmap **)gmallocn_checkoverflow(numInputSyms + numNewSyms,
				     sizeof(JBIG2Bitmap *));
  if (!bitmaps && numInputSyms + numNewSyms > 0) {

(In tricky pdf numInputSyms and numNewSyms are both 0).

Can You repair that, Albert? I'm quite close finishing the Coldwind stuff (probably closing it this weekend), but I can handle this afterwards...
Comment 2 Albert Astals Cid 2012-09-07 22:02:53 UTC
sure, i'll get this
Comment 3 Albert Astals Cid 2012-09-08 16:11:40 UTC
Unfortunately this only removes the warning output, the file is still not totally renderer correctly
Comment 4 Albert Astals Cid 2012-09-08 16:17:15 UTC
This is not critical
Comment 5 Steven Lee 2012-09-11 14:29:26 UTC
(In reply to comment #3)
> Unfortunately this only removes the warning output, the file is still not
> totally renderer correctly

yes, I tried 0.20.4, no error, but the output does not correct.
Comment 6 Thomas Freitag 2016-03-18 12:52:23 UTC
Created attachment 122419 [details] [review]
SDNUMEXSYMS is allowed to be 0!

This patch fixes it
Comment 7 Thomas Freitag 2016-03-18 13:01:49 UTC
The patch now doesn't break reading of the JBIG2 bitmap, and the PDF is rendered correct, but we get error messages again:

./utils/pdftoppm -png -cropbox 54579.open/tricky.pdf output/tricky
Syntax Error (1498): 1 extraneous byte after segment
Syntax Error (1536): 1 extraneous byte after segment

This happens when a segment with SDNUMEXSYMS = 0 was read (happens two times!). I digged into the spec, but I can't find out why there is exact one extraneous byte here or if there is something missing to read by the method. I looked into other JBIG2 decoders like jbic2dec, but these decoders don't complain about extraneous byte(s), they just skip to the next sgement.

So we probably can just skip silently, too, but that I let up to You Albert ;-)
Comment 8 GitLab Migration User 2018-08-20 21:46:47 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/65.

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.