Bug 22025

Summary: patch to fix message about illegal entry in bfchar block in ToUnicode CMap
Product: poppler Reporter: William Bader <williambader>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: suggested patch to poppler-0.10.7/poppler/CharCodeToUnicode.cc

Description William Bader 2009-06-01 14:30:19 UTC
Some applications write both the "from" and "to" mappings as four digit numbers even though the first two digits of the "from" mapping are always "00".  This patch allows poppler to handle files with four digit "from" mappings as long as the "from" value is in range.
Comment 1 William Bader 2009-06-01 14:31:46 UTC
Created attachment 26343 [details] [review]
suggested patch to poppler-0.10.7/poppler/CharCodeToUnicode.cc
Comment 2 William Bader 2009-06-01 14:50:29 UTC
My example file is 3 MB and was too large to post. Contact me by email at williambader@hotmail.com for a copy.
Comment 3 Albert Astals Cid 2009-06-02 13:45:14 UTC
Can you please mail the file to aacid@kde.org?
Comment 4 Albert Astals Cid 2009-06-03 12:08:03 UTC
What do you think of this?

diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index 0cbb4d7..b278d58 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -281,8 +281,11 @@ void CharCodeToUnicode::parseCMap1(int (*getCharFunc)(void *), void *data,
        }
        if (!(n1 == 2 + nDigits && tok1[0] == '<' && tok1[n1 - 1] == '>' &&
              tok2[0] == '<' && tok2[n2 - 1] == '>')) {
-         error(-1, "Illegal entry in bfchar block in ToUnicode CMap");
-         continue;
+         if (!(n1 == 4 + nDigits && tok1[0] == '<' && tok1[n1 - 1] == '>' && tok1[1] == '0' && tok1[2] == '0' &&
+               tok2[0] == '<' && tok2[n2 - 1] == '>')) {
+           error(-1, "Illegal entry in bfchar block in ToUnicode CMap");
+           continue;
+         }
        }
        tok1[n1 - 1] = tok2[n2 - 1] = '\0';
        if (sscanf(tok1 + 1, "%x", &code1) != 1) {
Comment 5 William Bader 2009-06-03 12:27:29 UTC
It works for me.
Comment 6 Albert Astals Cid 2009-06-03 13:01:43 UTC
Patch commited, will be in next poppler release

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.