Bug 22025 - patch to fix message about illegal entry in bfchar block in ToUnicode CMap
Summary: patch to fix message about illegal entry in bfchar 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: 2009-06-01 14:30 UTC by William Bader
Modified: 2009-06-03 13:01 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
suggested patch to poppler-0.10.7/poppler/CharCodeToUnicode.cc (1.10 KB, patch)
2009-06-01 14:31 UTC, William Bader
Details | Splinter Review

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.