aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexCPP.cxx
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2014-06-19 11:48:18 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2014-06-19 11:48:18 +1000
commit4b65e052bf2b3566bd50e6ba812e153e2a85e2b2 (patch)
tree48453a8eedfd56d5f498ca535430e868e7c60f18 /lexers/LexCPP.cxx
parent6eb24ea95d4e5f9f2c591da989a56e46342e31ef (diff)
downloadscintilla-mirror-4b65e052bf2b3566bd50e6ba812e153e2a85e2b2.tar.gz
Bug [#1614]. Don't crash on incomplete macro definition "#define x(".
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r--lexers/LexCPP.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index b7ff1859b..5485bf228 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -1220,7 +1220,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
size_t startValue = endArgs+1;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
- std::string value = restOfLine.substr(startValue);
+ std::string value;
+ if (startValue < restOfLine.length())
+ value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = SymbolValue(value, args);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
definitionsChanged = true;