diff options
| author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-01-26 12:45:58 +0100 |
|---|---|---|
| committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-01-26 12:45:58 +0100 |
| commit | df11fc95f94f3dd11bd2e74f4e29640538e5c050 (patch) | |
| tree | af6d836c2ab2f7be2cf35f9640c7d2a91670aad8 /src/shared/cplusplus/Parser.cpp | |
| parent | 3bb70c1c498af17e711fcd1ddc6dcce078b452ad (diff) | |
| download | qt-creator-df11fc95f94f3dd11bd2e74f4e29640538e5c050.tar.gz | |
Introduced a few paranoia checks.
Diffstat (limited to 'src/shared/cplusplus/Parser.cpp')
| -rw-r--r-- | src/shared/cplusplus/Parser.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 90631494a5..9ab40ce6f7 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -1603,9 +1603,16 @@ bool Parser::parseClassSpecifier(SpecifierListAST *&node) unsigned start_declaration = cursor(); DeclarationAST *declaration = 0; if (parseMemberSpecification(declaration)) { - *declaration_ptr = new (_pool) DeclarationListAST; - (*declaration_ptr)->value = declaration; - declaration_ptr = &(*declaration_ptr)->next; + if (declaration) { // paranoia check + *declaration_ptr = new (_pool) DeclarationListAST; + (*declaration_ptr)->value = declaration; + declaration_ptr = &(*declaration_ptr)->next; + } + + if (cursor() == start_declaration) { // more paranoia + rewind(start_declaration + 1); + skipUntilDeclaration(); + } } else { _translationUnit->error(start_declaration, "expected a declaration"); rewind(start_declaration + 1); |
