Open danglotb opened 6 years ago
Hi,
I am trying to find a way to fix this. I am using the little example provided by @MateusAraujoBorges in #11.
The Exception is raised when the ConcolicInterpreter
visit the PUTFIELD
.
I tried to log some information about the case:
The toString()
of the concerned ObjectInfo
ObjectInfo{
fieldNameToIndex={irrelevant0=1, tmp=0},
fieldList=[
FieldInfo{
className='tests.bugreports.putfieldbug.SienaBuggyExample',
fieldName='tmp',
isStatic=false,
fieldId=1
},
FieldInfo{
className='tests.bugreports.putfieldbug.SienaBuggyExample',
fieldName='irrelevant0',
isStatic=false,
fieldId=-1
}
],
staticFieldNameToIndex=null, staticFieldList=null, nStaticFields=0, nFields=2, statics=[], className='tests.bugreports.putfieldbug.SienaBuggyExample'
}
I think there is an error in the indexing of fields because the field irrelevant0 has an index = -1 and we can see that the values in fieldNameToIndex
does not match with the fieldId
in each FieldInfo
.
Here, find the instrumentation of the class under test:
public class SienaBuggyExample {
private int irrelevant0;
private Object tmp;
public SienaBuggyExample(int x) {
label201: {
DJVM.ALOAD(1025, 1, 0);
super();
DJVM.ALOAD(1026, 1, 0);
DJVM.GETVALUE_Object(this);
DJVM.NEW(1027, 1, "java/lang/Object", 0);
DJVM.SPECIAL(0);
DJVM.DUP(1028, 1);
Object var10001 = new Object();
DJVM.PUTFIELD(1029, 1, 1, 0, "Ljava/lang/Object;"); // here the PUTFIELD raising the exception
this.tmp = var10001;
DJVM.SPECIAL(0);
DJVM.ILOAD(1030, 1, 1);
...
...
...
Another things it is maybe the initialization of the ObjectValue
. I'll keep going deeper in CATG and find out, but If you have any tips or hint It could be very useful.
Thank you very much!
-- Benjamin.
Hi again,
According to my finding, the problem is that : here, we get the ref
object from the currentFrame field of the ConcolicInterpreter
.
The problem is, just before, we push in the stack the value of the field itself with:
DJVM.NEW(1027, 1, "java/lang/Object", 0);
So, it results with when with call:
ObjectValue ref = (ObjectValue) currentFrame.pop();
ref.setField(fi.getFieldId(), value);
the ref
is the field itself, and we can't call setField()
on it because it is not the corresponding object.
I have found a solution, but I am not sure that it is the good way to do.
please find in: #9
Thank you.
Hello,
I am running CATG on javapoet and I am facing to an exception:
happening when I try to run CATG on:
I assumed that there is a problem with the fields of the class
com.squareup.javapoet.CodeWriter
.Find here, an excerpt of this class:
Do you have any idea or tips to fix this issues?
Best regards,
Benjamin.