[poppler] poppler/PSTokenizer.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed Dec 20 23:58:31 UTC 2017
poppler/PSTokenizer.cc | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 79a096a48c735ac301ae4d7439bddf630a559a96
Author: Vincent Le Garrec <legarrec.vincent at gmail.com>
Date: Thu Dec 21 00:57:48 2017 +0100
Fix index out of bounds undefined behaviour in PSTokenizer
Bug #103583
diff --git a/poppler/PSTokenizer.cc b/poppler/PSTokenizer.cc
index 05127f0d..ddde6bc1 100644
--- a/poppler/PSTokenizer.cc
+++ b/poppler/PSTokenizer.cc
@@ -15,6 +15,7 @@
//
// Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
// Copyright (C) 2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2017 Vincent Le Garrec <legarrec.vincent at gmail.com>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -84,7 +85,7 @@ GBool PSTokenizer::getToken(char *buf, int size, int *length) {
}
} else if (c == '%') {
comment = gTrue;
- } else if (specialChars[c] != 1) {
+ } else if (specialChars[static_cast<unsigned char>(c)] != 1) {
break;
}
}
@@ -113,7 +114,7 @@ GBool PSTokenizer::getToken(char *buf, int size, int *length) {
} else if (c == '<') {
while ((c = lookChar()) != EOF) {
consumeChar();
- if (i < size && specialChars[c] != 1) {
+ if (i < size && specialChars[static_cast<unsigned char>(c)] != 1) {
buf[i++] = c;
}
if (c == '>') {
@@ -121,7 +122,7 @@ GBool PSTokenizer::getToken(char *buf, int size, int *length) {
}
}
} else if (c != '[' && c != ']') {
- while ((c = lookChar()) != EOF && !specialChars[c]) {
+ while ((c = lookChar()) != EOF && !specialChars[static_cast<unsigned char>(c)]) {
consumeChar();
if (i < size) {
buf[i++] = c;
More information about the poppler
mailing list