fix read beyond end of input line

a line ending in two backslashes would produce a literal backslash and
run off the end.

Task-number: QTCREATORBUG-3360
This commit is contained in:
Oswald Buddenhagen
2011-01-17 18:18:22 +01:00
parent f1d618ab5b
commit cef5754641

View File

@@ -422,7 +422,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
} while (c == ' ' || c == '\t');
forever {
if (c == '$') {
if (*cur == '$') { // may be EOF, EOL, WS or '#' if past end
if (*cur == '$') { // may be EOF, EOL, WS, '#' or '\\' if past end
cur++;
if (putSpace) {
putSpace = false;
@@ -541,7 +541,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
xprPtr = ptr;
goto nextChr;
}
} else if (c == '\\') {
} else if (c == '\\' && cur != end) {
static const char symbols[] = "[]{}()$\\'\"";
ushort c2 = *cur;
if (!(c2 & 0xff00) && strchr(symbols, c2)) {