diff options
author | nyamatongwe <unknown> | 2012-12-30 16:16:58 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2012-12-30 16:16:58 +1100 |
commit | b10a61c045bc2af559fbc42c8d0034c160c87013 (patch) | |
tree | 575cdd9f6f9b9afdc7412fc087fa2e2599bc9fa6 /lexers/LexCPP.cxx | |
parent | 971b824a22f383373a6fe45e0fae1e06944a25e5 (diff) | |
download | scintilla-mirror-b10a61c045bc2af559fbc42c8d0034c160c87013.tar.gz |
Bug #3578824. Avoid crashes due to char being signed so negative for non-ASCII.
From Isiledhel.
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r-- | lexers/LexCPP.cxx | 10 |
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++; } |