Bug 30521 - Illegal entry in bfrange block in ToUnicode CMap
Summary: Illegal entry in bfrange block in ToUnicode CMap
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 16:09 UTC by William Bader
Modified: 2010-11-14 14:15 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
proposed patch (4.00 KB, application/octet-stream)
2010-09-30 16:09 UTC, William Bader
Details

Description William Bader 2010-09-30 16:09:54 UTC
Created attachment 39087 [details]
proposed patch

pdftops (as copied from git on 30 Sep 2010) gets "Illegal entry in bfrange block in ToUnicode CMap" on what I think is a valid file.
I had a PDF file and compressed it with ps2pdf from ghostscript 9.00.
When I run the resulting PDF through poppler's pdftops, I get the errors.
I have attached patches that show more information and that stop the message.
The messages (before the change to fix them) look like the example below.
Error: Illegal entry in bfrange block in ToUnicode CMap, nBits 16 nDigits 4, found '<45>' '<46>'
The PDF has a 16 bit table, but the values have only two hex digits, and poppler isn't parsing it correctly.
In poppler-30sep10/poppler/CharCodeToUnicode.cc, I made the change
        if (!(((n1 == 2 + nDigits && tok1[0] == '<' && tok1[n1 - 1] == '>') ||
+              (nDigits > 2 && n1 == 2 + 2 && tok1[0] == '<' && tok1[2 + 2 - 1] == '>') ||
               (n1 == 4 + nDigits && tok1[0] == '<' && tok1[n1 - 1] == '>' && tok1[1] == '0' && tok1[2] == '0')) &&
              ((n2 == 2 + nDigits && tok2[0] == '<' && tok2[n2 - 1] == '>') ||
+              (nDigits > 2 && n2 == 2 + 2 && tok2[0] == '<' && tok2[2 + 2 - 1] == '>') ||
               (n2 == 4 + nDigits && tok2[0] == '<' && tok2[n2 - 1] == '>' && tok1[1] == '0' && tok1[2] == '0')))) {
-         error(-1, "Illegal entry in bfrange block in ToUnicode CMap");
+         error(-1, "Illegal entry in bfrange block in ToUnicode CMap, nBits %d nDigits %d, found '%.*s' '%.*s'", nBits, nDigits, n1, tok1, n2, tok2);
          continue;
        }
Comment 1 Albert Astals Cid 2010-10-21 11:06:55 UTC
Can you share a pdf that exhibits this problem?
Comment 2 William Bader 2010-10-21 13:12:09 UTC
I have temporarily copied the files to my web site.  They are over 8 MB so I couldn't attach them when I reported the problem.

Original file that does not get the error.
http://williambader.com/LFW_20100401-orig.pdf

Generated file that gets the error.
http://williambader.com/LFW_20100401-bfrange.pdf

Another file that got the error in previous versions of poppler.
http://williambader.com/1288986-ps2pdf-popplerbug.pdf
Comment 3 Albert Astals Cid 2010-11-14 08:56:41 UTC
Hmmm, i'm running ./utils/pdftops ~/okularfiles/pdf/LFW_20100401-bfrange.pdf and don't get any warning, are you sure that is the one that gives warnings?
Comment 4 William Bader 2010-11-14 09:14:50 UTC
Yes, that is the file.  I just checked with poppler-0.12.4.
/u/gnu/poppler-0.12.4/utils$ ./pdftops LFW_20100401-bfrange.pdf xxx 2>&1 | sort | uniq -c
  14718 Error: Illegal entry in bfrange block in ToUnicode CMap
I recently updated my system to Fedora 14, and the distributed pdftops does not show the problem, so maybe it has been fixed by another change.
Comment 5 Albert Astals Cid 2010-11-14 11:41:36 UTC
Poppler 0.12.4 is a bit old, can you test with 0.14.5 or 0.15.2 if possible
Comment 6 William Bader 2010-11-14 12:24:45 UTC
I tried with 0.15.2.  I didn't get the bfrange errors but I got one warning about an illegal character.  Both the pdftops 0.14.4 distributed with Fedora 14 and my old patched pdftops 0.15.0 do not report any errors or warnings with this file.

/u/gnu/poppler-0.15.2/utils$ ./pdftops LFW_20100401-bfrange.pdf xxx
Error (72): Illegal character '}'
Comment 7 Albert Astals Cid 2010-11-14 14:15:19 UTC
That's not the problem you reported in this bug, if you are sure that is a bug, please open a new bug report.


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.