From 88632908b8923e626f36b6132ac179553d39c333 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 28 Oct 2009 14:48:32 +0100 Subject: Fixed possible crash when inserting semicolon. Don't insert T_SEMICOLON when yytoken == -1 Done-with: joerg --- src/declarative/qml/parser/qmljs.g | 2 +- src/declarative/qml/parser/qmljsgrammar.cpp | 2 +- src/declarative/qml/parser/qmljsgrammar_p.h | 2 +- src/declarative/qml/parser/qmljsparser.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g index eb9a8ab..c5b2764 100644 --- a/src/declarative/qml/parser/qmljs.g +++ b/src/declarative/qml/parser/qmljs.g @@ -2949,7 +2949,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; const int errorState = state_stack[tos]; // automatic insertion of `;' - if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) { + if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) { SavedToken &tk = token_buffer[0]; tk.token = yytoken; tk.dval = yylval; diff --git a/src/declarative/qml/parser/qmljsgrammar.cpp b/src/declarative/qml/parser/qmljsgrammar.cpp index da3ce2a..2b92b82 100644 --- a/src/declarative/qml/parser/qmljsgrammar.cpp +++ b/src/declarative/qml/parser/qmljsgrammar.cpp @@ -4,7 +4,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h index b297f81..20d7188 100644 --- a/src/declarative/qml/parser/qmljsgrammar_p.h +++ b/src/declarative/qml/parser/qmljsgrammar_p.h @@ -4,7 +4,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp index 402aaeb..dd2553f 100644 --- a/src/declarative/qml/parser/qmljsparser.cpp +++ b/src/declarative/qml/parser/qmljsparser.cpp @@ -1713,7 +1713,7 @@ case 337: { const int errorState = state_stack[tos]; // automatic insertion of `;' - if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) { + if (yytoken != -1 && t_action(errorState, T_AUTOMATIC_SEMICOLON) && automatic(driver, yytoken)) { SavedToken &tk = token_buffer[0]; tk.token = yytoken; tk.dval = yylval; -- cgit v0.12