Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Krasilnikov2006-06-21 11:55:46 +0000
committerOleg Krasilnikov2006-06-21 11:55:46 +0000
commiteb6414526f47e06ff95e449d72873228ae169ce3 (patch)
tree53fa5df50092f0837ced3e2dc966cd1f4312ec40
parentcd052ee5de51bfd331c17cf21936f563ff9b3eab (diff)
downloadorg.eclipse.cdt-eb6414526f47e06ff95e449d72873228ae169ce3.tar.gz
org.eclipse.cdt-eb6414526f47e06ff95e449d72873228ae169ce3.tar.xz
org.eclipse.cdt-eb6414526f47e06ff95e449d72873228ae169ce3.zip
[Bug 147999] CModelBuilder runs into infinite loop
Additional check to avoid looping in "nextTable[]" values
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharTable.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectTable.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharTable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharTable.java
index 4d26b788b0..fe849e0a6d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharTable.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharTable.java
@@ -159,7 +159,7 @@ public class CharTable extends HashTable {
return i;
// Follow the next chain
- for (i = nextTable[i] - 1; i >= 0; i = nextTable[i] - 1)
+ for (i = nextTable[i] - 1; i >= 0 && nextTable[i] != i + 1; i = nextTable[i] - 1)
if (CharArrayUtils.equals(buffer, start, len, keyTable[i]))
return i;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectTable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectTable.java
index 01bdb6db5e..7e99633714 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectTable.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/ObjectTable.java
@@ -120,7 +120,7 @@ public abstract class ObjectTable extends HashTable implements Cloneable{
return i;
// Follow the next chain
- for (i = nextTable[i] - 1; i >= 0; i = nextTable[i] - 1)
+ for (i = nextTable[i] - 1; i >= 0 && nextTable[i] != i + 1; i = nextTable[i] - 1)
if ( buffer.equals( keyTable[i] ))
return i;

Back to the top