diff options
author | Markus Schorn | 2008-04-08 07:50:56 +0000 |
---|---|---|
committer | Markus Schorn | 2008-04-08 07:50:56 +0000 |
commit | aa398a08a44622ea5eda3907e72850cb02dac5ac (patch) | |
tree | 08692f61a695304e15d3ec42a35eada728137ed1 | |
parent | 19fdfea4a2cafc84cbb836a8e53b7341ee302788 (diff) | |
download | org.eclipse.cdt-aa398a08a44622ea5eda3907e72850cb02dac5ac.tar.gz org.eclipse.cdt-aa398a08a44622ea5eda3907e72850cb02dac5ac.tar.xz org.eclipse.cdt-aa398a08a44622ea5eda3907e72850cb02dac5ac.zip |
Added two guards against infinite loops, bug 209813.
-rw-r--r-- | core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java | 5 | ||||
-rw-r--r-- | core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java index 22bae4b30bf..9fb9d8b558f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -295,7 +295,8 @@ public class ASTTypeUtil { IType[] types = new IType[DEAULT_ITYPE_SIZE]; // push all of the types onto the stack - while(type != null) { + int i=0; + while(type != null && ++i<100) { final boolean isTypedef= type instanceof ITypedef; if (!resolveTypedefs || !isTypedef) { types = (IType[]) ArrayUtil.append( IType.class, types, type ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java index 2dbaefcf695..508235ea1b7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPSemantics.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. + * Copyright (c) 2004, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1103,7 +1103,9 @@ public class CPPSemantics { if( directives != null && directives.array != null && directives.array.length != 0 ) processDirectives( data, scope, directives.array ); - while( !data.usingDirectives.isEmpty() && data.usingDirectives.get( scope ) != null ){ + // guard agains infinite loop, bug 209813 + int i= 0; + while( !data.usingDirectives.isEmpty() && data.usingDirectives.get( scope ) != null && ++i<100){ transitives = lookupInNominated( data, scope, transitives ); if( !data.qualified() || ( data.contentAssist || !data.hasResults()) ){ |