aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2012-12-30 16:16:58 +1100
committernyamatongwe <devnull@localhost>2012-12-30 16:16:58 +1100
commit0d593286ecdc237e7fdf10d3bdce1935098da580 (patch)
treeecf162aaaabcaf971779e3ae97b93a73296d8e9f
parent50be730db62b147c743f82bb92f9cf424f36fb7f (diff)
downloadscintilla-mirror-0d593286ecdc237e7fdf10d3bdce1935098da580.tar.gz
Bug #3578824. Avoid crashes due to char being signed so negative for non-ASCII.
From Isiledhel.
-rw-r--r--lexers/LexCPP.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index 952037e9b..116d5a2b3 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -1172,7 +1172,7 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map<std::s
std::vector<std::string> tokens;
const char *cp = expr.c_str();
for (;;) {
- if (setWord.Contains(*cp)) {
+ if (setWord.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
} else {
std::map<std::string, std::string>::const_iterator it = preprocessorDefinitions.find(word);
@@ -1187,13 +1187,13 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map<std::s
}
if ((*cp != ' ') && (*cp != '\t')) {
std::string op(cp, 1);
- if (setRelOp.Contains(*cp)) {
- if (setRelOp.Contains(cp[1])) {
+ if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
+ if (setRelOp.Contains(static_cast<unsigned char>(cp[1]))) {
op += cp[1];
cp++;
}
- } else if (setLogicalOp.Contains(*cp)) {
- if (setLogicalOp.Contains(cp[1])) {
+ } else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
+ if (setLogicalOp.Contains(static_cast<unsigned char>(cp[1]))) {
op += cp[1];
cp++;
}