Incorporated commit 38c0ed9870fc6bd8ba759c283eaf2bffb61c2e3f from kinetic-declarativeui.

Fixed possible array index-out-of-bounds crash in error reporting.
This commit is contained in:
Erik Verbruggen
2010-01-21 16:47:46 +01:00
parent 60af1681c2
commit 2395ec51a6
2 changed files with 12 additions and 2 deletions

View File

@@ -1761,7 +1761,12 @@ case 340: {
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
QString msg;
int token = token_buffer[0].token;
if (token < 0 || token >= TERMINAL_COUNT)
msg = qApp->translate("QmlParser", "Syntax error");
else
msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;