1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

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>
This commit is contained in:
Marc-Andre Laperle 2019-07-10 00:30:54 -04:00
parent 577061ac79
commit 76b7b64307
3 changed files with 12 additions and 1 deletions

View file

@ -47,6 +47,11 @@ public class PDOMCPPFieldTemplate extends PDOMCPPVariableTemplate implements ICP
return IIndexCPPBindingConstants.CPP_FIELD_TEMPLATE;
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public ICompositeType getCompositeTypeOwner() {
return getClassOwner();

View file

@ -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)

View file

@ -63,6 +63,11 @@ public class PDOMCPPVariableTemplatePartialSpecialization extends PDOMCPPVariabl
return IIndexCPPBindingConstants.CPP_VARIABLE_TEMPLATE_PARTIAL_SPECIALIZATION;
}
@Override
protected int getRecordSize() {
return RECORD_SIZE;
}
@Override
public ICPPTemplateDefinition getPrimaryTemplate() {
try {