diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2015-07-25 13:54:26 +0200 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2015-07-27 14:44:58 +0200 |
commit | acecda5931657d155cba9f3c56e209693f02a086 (patch) | |
tree | 085ef6bd52ab06bbde1a42d67bb1947296582215 /source | |
parent | b1c2fd4e46d7dffa458a00f1e03471b52b62f01a (diff) | |
download | mupdf-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')
-rw-r--r-- | source/pdf/pdf-encoding.c | 10 |
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 }; |