forked from qt-creator/qt-creator
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:
@@ -422,7 +422,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
|
|||||||
} while (c == ' ' || c == '\t');
|
} while (c == ' ' || c == '\t');
|
||||||
forever {
|
forever {
|
||||||
if (c == '$') {
|
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++;
|
cur++;
|
||||||
if (putSpace) {
|
if (putSpace) {
|
||||||
putSpace = false;
|
putSpace = false;
|
||||||
@@ -541,7 +541,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in)
|
|||||||
xprPtr = ptr;
|
xprPtr = ptr;
|
||||||
goto nextChr;
|
goto nextChr;
|
||||||
}
|
}
|
||||||
} else if (c == '\\') {
|
} else if (c == '\\' && cur != end) {
|
||||||
static const char symbols[] = "[]{}()$\\'\"";
|
static const char symbols[] = "[]{}()$\\'\"";
|
||||||
ushort c2 = *cur;
|
ushort c2 = *cur;
|
||||||
if (!(c2 & 0xff00) && strchr(symbols, c2)) {
|
if (!(c2 & 0xff00) && strchr(symbols, c2)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user