Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2019-07-10 00:30:54 -0400
committerMarc-Andre Laperle2019-07-10 21:52:38 -0400
commit76b7b643071657af67a376053863b6fb0e07bcd4 (patch)
treed7c507ca2d591472102c8fd2545c21a768d1972e /core/org.eclipse.cdt.core/parser/org/eclipse/cdt
parent577061ac795f4a8469c07abd288e7e348a5a1a24 (diff)
downloadorg.eclipse.cdt-76b7b643071657af67a376053863b6fb0e07bcd4.tar.gz
org.eclipse.cdt-76b7b643071657af67a376053863b6fb0e07bcd4.tar.xz
org.eclipse.cdt-76b7b643071657af67a376053863b6fb0e07bcd4.zip
Bug 549028 - Fix missing getRecordSize() leading to index corruption
Because of the missing getRecordSize implementations, subclasses would starting writing in records that were thought to be malloc'ed by the parent but it was instead writing in other blocks, possible used by other PDOM objects or free blocks to be used later and now not initialized to 0. This could lead to a few different exceptions like - BufferUnderflowException(Chunk.getChars) - CoreException: Corrupted database - ArrayIndexOutOfBoundsException(AbstractIndexerTask$IndexFileContent.merge) and possibly others. Change-Id: Ie6d1986a22a9fb5f5e90cb741046d098ebf10a90 Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
Diffstat (limited to 'core/org.eclipse.cdt.core/parser/org/eclipse/cdt')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplate.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplatePartialSpecialization.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplatePartialSpecialization.java5
3 files changed, 12 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplate.java
index 414f08f250..6245ae115c 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplate.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplate.java
@@ -48,6 +48,11 @@ public class PDOMCPPFieldTemplate extends PDOMCPPVariableTemplate implements ICP
}
@Override
+ protected int getRecordSize() {
+ return RECORD_SIZE;
+ }
+
+ @Override
public ICompositeType getCompositeTypeOwner() {
return getClassOwner();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplatePartialSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplatePartialSpecialization.java
index 026dfe7bb1..56ad7571b1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplatePartialSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPFieldTemplatePartialSpecialization.java
@@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFieldTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariableTemplatePartialSpecialization;
import org.eclipse.cdt.internal.core.index.IIndexCPPBindingConstants;
@@ -28,7 +29,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
import org.eclipse.core.runtime.CoreException;
public class PDOMCPPFieldTemplatePartialSpecialization extends PDOMCPPVariableTemplatePartialSpecialization
- implements ICPPField {
+ implements ICPPFieldTemplate {
public PDOMCPPFieldTemplatePartialSpecialization(PDOMCPPLinkage linkage, PDOMNode parent,
ICPPVariableTemplatePartialSpecialization parSpec, PDOMCPPFieldTemplate pdomPrimary)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplatePartialSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplatePartialSpecialization.java
index 81334558db..5a32ce8aea 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplatePartialSpecialization.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPVariableTemplatePartialSpecialization.java
@@ -64,6 +64,11 @@ public class PDOMCPPVariableTemplatePartialSpecialization extends PDOMCPPVariabl
}
@Override
+ protected int getRecordSize() {
+ return RECORD_SIZE;
+ }
+
+ @Override
public ICPPTemplateDefinition getPrimaryTemplate() {
try {
return new PDOMCPPVariableTemplate(getLinkage(), getPrimaryTemplateRec());

Back to the top