summaryrefslogtreecommitdiff
path: root/pdf/pdf_cmap.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-31 17:58:34 +0000
committerRobin Watts <robin.watts@artifex.com>2012-01-31 18:01:37 +0000
commit3e65ed4eb3a8aa8cd6375a7029ac3b61a35a1157 (patch)
tree414965143f8ec0ca505e046847e2ea647e3e6149 /pdf/pdf_cmap.c
parent0da4f606b85007f6c1bdfc9255ccef8307dabb11 (diff)
downloadmupdf-3e65ed4eb3a8aa8cd6375a7029ac3b61a35a1157.tar.xz
Fix big 692824: incorrect application of word space.
Word space should only be applied when the codepoint is 32, and is read from a single byte encoding region. Ghostscript gets this wrong too.
Diffstat (limited to 'pdf/pdf_cmap.c')
-rw-r--r--pdf/pdf_cmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pdf/pdf_cmap.c b/pdf/pdf_cmap.c
index 4430979c..587b82e2 100644
--- a/pdf/pdf_cmap.c
+++ b/pdf/pdf_cmap.c
@@ -483,11 +483,12 @@ pdf_lookup_cmap_full(pdf_cmap *cmap, int cpt, int *out)
* multi-byte encoded string.
*/
unsigned char *
-pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, int *cpt)
+pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, int *cpt, int *w)
{
int k, n, c;
c = 0;
+ *w = 0;
for (n = 0; n < 4; n++)
{
c = (c << 8) | buf[n];
@@ -498,6 +499,7 @@ pdf_decode_cmap(pdf_cmap *cmap, unsigned char *buf, int *cpt)
if (c >= cmap->codespace[k].low && c <= cmap->codespace[k].high)
{
*cpt = c;
+ *w = n + 1;
return buf + n + 1;
}
}