summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-06-20 21:55:33 +0200
committerTor Andersson <tor@ghostscript.com>2010-06-20 21:55:33 +0200
commit194ac682d758ef26a9958ef39c851974808f33d9 (patch)
tree88e2e309bc48481b17d0328c96dd1ca3258d7be4
parent22298ce9403e95b9241026a1be93b0f30b756a83 (diff)
downloadmupdf-194ac682d758ef26a9958ef39c851974808f33d9.tar.xz
Be lenient about invalid cmap syntax.
-rw-r--r--mupdf/pdf_cmap_parse.c18
-rw-r--r--mupdf/pdf_cmap_table.c2
2 files changed, 8 insertions, 12 deletions
diff --git a/mupdf/pdf_cmap_parse.c b/mupdf/pdf_cmap_parse.c
index ec58396e..824cbf8b 100644
--- a/mupdf/pdf_cmap_parse.c
+++ b/mupdf/pdf_cmap_parse.c
@@ -76,12 +76,11 @@ pdf_parsecmapname(pdf_cmap *cmap, fz_stream *file)
return fz_rethrow(error, "syntaxerror in cmap");
if (tok == PDF_TNAME)
- {
fz_strlcpy(cmap->cmapname, buf, sizeof(cmap->cmapname));
- return fz_okay;
- }
+ else
+ fz_warn("expected name after CMapName in cmap");
- return fz_throw("expected name");
+ return fz_okay;
}
static fz_error
@@ -97,12 +96,11 @@ pdf_parsewmode(pdf_cmap *cmap, fz_stream *file)
return fz_rethrow(error, "syntaxerror in cmap");
if (tok == PDF_TINT)
- {
pdf_setwmode(cmap, atoi(buf));
- return fz_okay;
- }
+ else
+ fz_warn("expected integer after WMode in cmap");
- return fz_throw("expected integer");
+ return fz_okay;
}
static fz_error
@@ -406,7 +404,7 @@ pdf_parsecmap(pdf_cmap **cmapp, fz_stream *file)
error = pdf_parsecmapname(cmap, file);
if (error)
{
- error = fz_rethrow(error, "syntaxerror in cmap after /CMapName");
+ error = fz_rethrow(error, "syntaxerror in cmap after CMapName");
goto cleanup;
}
}
@@ -415,7 +413,7 @@ pdf_parsecmap(pdf_cmap **cmapp, fz_stream *file)
error = pdf_parsewmode(cmap, file);
if (error)
{
- error = fz_rethrow(error, "syntaxerror in cmap after /WMode");
+ error = fz_rethrow(error, "syntaxerror in cmap after WMode");
goto cleanup;
}
}
diff --git a/mupdf/pdf_cmap_table.c b/mupdf/pdf_cmap_table.c
index d29a2f36..a1f61365 100644
--- a/mupdf/pdf_cmap_table.c
+++ b/mupdf/pdf_cmap_table.c
@@ -8,8 +8,6 @@
#include "mupdf.h"
extern pdf_cmap pdf_cmap_Adobe_CNS1_0;
-
-extern pdf_cmap pdf_cmap_Adobe_CNS1_0;
extern pdf_cmap pdf_cmap_Adobe_CNS1_1;
extern pdf_cmap pdf_cmap_Adobe_CNS1_2;
extern pdf_cmap pdf_cmap_Adobe_CNS1_3;