summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-lex.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/pdf/pdf-lex.c b/source/pdf/pdf-lex.c
index c7ba122b..34c753ab 100644
--- a/source/pdf/pdf-lex.c
+++ b/source/pdf/pdf-lex.c
@@ -35,6 +35,11 @@ static inline int iswhite(int ch)
ch == '\040';
}
+static inline int isprint(int ch)
+{
+ return ch >= ' ' && ch <= '~';
+}
+
static inline int unhex(int ch)
{
if (ch >= '0' && ch <= '9') return ch - '0';
@@ -439,8 +444,13 @@ pdf_token_from_keyword(char *key)
case 'x':
if (!strcmp(key, "xref")) return PDF_TOK_XREF;
break;
- default:
- break;
+ }
+
+ while (*key)
+ {
+ if (!isprint(*key))
+ return PDF_TOK_ERROR;
+ ++key;
}
return PDF_TOK_KEYWORD;