summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-encoding.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2015-07-25 13:54:26 +0200
committerSebastian Rasmussen <sebras@gmail.com>2015-07-27 14:44:58 +0200
commitacecda5931657d155cba9f3c56e209693f02a086 (patch)
tree085ef6bd52ab06bbde1a42d67bb1947296582215 /source/pdf/pdf-encoding.c
parentb1c2fd4e46d7dffa458a00f1e03471b52b62f01a (diff)
downloadmupdf-acecda5931657d155cba9f3c56e209693f02a086.tar.xz
Limit font encoding differences to unicode.
Previously encoding differences were allowed outside the valid unicode codepoint range. Fixes one issue from bug 696012.
Diffstat (limited to 'source/pdf/pdf-encoding.c')
-rw-r--r--source/pdf/pdf-encoding.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/pdf/pdf-encoding.c b/source/pdf/pdf-encoding.c
index c634a9ee..e8e7532d 100644
--- a/source/pdf/pdf-encoding.c
+++ b/source/pdf/pdf-encoding.c
@@ -30,6 +30,7 @@ pdf_lookup_agl(char *name)
char *p;
int l = 0;
int r = nelem(agl_name_list) - 1;
+ int code = 0;
fz_strlcpy(buf, name, sizeof buf);
@@ -51,14 +52,15 @@ pdf_lookup_agl(char *name)
return agl_code_list[m];
}
+
if (strstr(buf, "uni") == buf)
- return strtol(buf + 3, NULL, 16);
+ code = strtol(buf + 3, NULL, 16);
else if (strstr(buf, "u") == buf)
- return strtol(buf + 1, NULL, 16);
+ code = strtol(buf + 1, NULL, 16);
else if (strstr(buf, "a") == buf && strlen(buf) >= 3)
- return strtol(buf + 1, NULL, 10);
+ code = strtol(buf + 1, NULL, 10);
- return 0;
+ return (code >= 0 && code <= 0x10ffff) ? code : 0;
}
static const char *empty_dup_list[] = { 0 };