mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed Bug 92980 - [Parser] infinite loop caused by invalid source code
This commit is contained in:
parent
15fc3932fa
commit
308e1f4417
2 changed files with 8 additions and 0 deletions
|
@ -3792,5 +3792,10 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertEquals( declarators.length, 1 );
|
||||
assertTrue( declarators[0] instanceof IASTArrayDeclarator );
|
||||
}
|
||||
|
||||
public void testBug92980() throws Exception {
|
||||
String code = "struct A { A(); A(const A&) throw(1); ~A() throw(X); };"; //$NON-NLS-1$
|
||||
parse( code, ParserLanguage.CPP, true, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3943,6 +3943,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
consume();
|
||||
break;
|
||||
default:
|
||||
IToken before = LA(1);
|
||||
try {
|
||||
exceptionSpecIds.add(typeId(false, false));
|
||||
} catch (BacktrackException e) {
|
||||
|
@ -3955,6 +3956,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
p
|
||||
.setPropertyInParent(IASTProblemHolder.PROBLEM);
|
||||
exceptionSpecIds.add(typeIdProblem);
|
||||
if( before == LA(1) )
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue