Program: 186948
Project: 186948
Buggy source:
public ContextMap<CallString,SymbolicAddressMap> transfer(InstructionHandle stmt,FlowEdge edge,ContextMap<CallString,SymbolicAddressMap> input,Interpreter<CallString,SymbolicAddressMap> interpreter,Map<InstructionHandle,ContextMap<CallString,SymbolicAddressMap>> state){
  Context context=new Context(input.getContext());
  SymbolicAddressMap in=input.get(context.callString);
  ContextMap<CallString,SymbolicAddressMap> retval=new ContextMap<CallString,SymbolicAddressMap>(context,input);
  Instruction instruction=stmt.getInstruction();
  int newStackPtr=context.stackPtr + instruction.produceStack(context.constPool) - instruction.consumeStack(context.constPool);
switch (instruction.getOpcode()) {
case Constants.ICONST_M1:
case Constants.ICONST_0:
case Constants.ICONST_1:
case Constants.ICONST_2:
case Constants.ICONST_3:
case Constants.ICONST_4:
case Constants.ICONST_5:
case Constants.BIPUSH:
case Constants.SIPUSH:
{
      retval.put(context.callString,in.cloneFilterStack(newStackPtr));
    }
  break;
case Constants.ACONST_NULL:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.LDC:
case Constants.LDC_W:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.LDC2_W:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.ISTORE_0:
case Constants.ISTORE_1:
case Constants.ISTORE_2:
case Constants.ISTORE_3:
case Constants.ISTORE:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.ASTORE_0:
case Constants.ASTORE_1:
case Constants.ASTORE_2:
case Constants.ASTORE_3:
case Constants.ASTORE:
{
StoreInstruction instr=(StoreInstruction)instruction;
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
result.putStack(instr.getIndex(),in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.ILOAD_0:
case Constants.ILOAD_1:
case Constants.ILOAD_2:
case Constants.ILOAD_3:
case Constants.ILOAD:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.ALOAD_0:
case Constants.ALOAD_1:
case Constants.ALOAD_2:
case Constants.ALOAD_3:
case Constants.ALOAD:
{
LoadInstruction instr=(LoadInstruction)instruction;
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
result.putStack(context.stackPtr,in.getStack(instr.getIndex()));
retval.put(context.callString,result);
}
break;
case Constants.ARRAYLENGTH:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.PUTFIELD:
{
PUTFIELD instr=(PUTFIELD)instruction;
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
retval.put(context.callString,SymbolicAddressMap.TOP);
}
 else {
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
}
break;
case Constants.GETFIELD:
{
GETFIELD instr=(GETFIELD)instruction;
objects.put(stmt,input);
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
BoundedSet<SymbolicAddress> objectMapping=in.getStack(context.stackPtr - 1);
BoundedSet<SymbolicAddress> newMapping;
if (objectMapping == bsFactory.top()) {
newMapping=bsFactory.top();
}
 else {
newMapping=bsFactory.empty();
for (SymbolicAddress addr : objectMapping.getSet()) {
newMapping.add(addr.access(instr.getFieldName(context.constPool)));
}
}
result.putStack(context.stackPtr - 1,newMapping);
}
retval.put(context.callString,result);
}
break;
case Constants.PUTSTATIC:
{
PUTSTATIC instr=(PUTSTATIC)instruction;
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
retval.put(context.callString,SymbolicAddressMap.TOP);
}
 else {
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
}
break;
case Constants.GETSTATIC:
{
GETSTATIC instr=(GETSTATIC)instruction;
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
BoundedSet<SymbolicAddress> newMapping=bsFactory.empty();
newMapping.add(SymbolicAddress.staticField(instr.getFieldName(context.constPool)));
result.putStack(context.stackPtr,newMapping);
}
retval.put(context.callString,result);
}
break;
case Constants.IASTORE:
case Constants.CASTORE:
case Constants.SASTORE:
case Constants.BASTORE:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.AASTORE:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.IALOAD:
case Constants.CALOAD:
case Constants.SALOAD:
case Constants.BALOAD:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.AALOAD:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.DUP:
{
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
result.putStack(context.stackPtr,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.DUP_X1:
{
SymbolicAddressMap result=in.cloneFilterStack(context.stackPtr - 2);
result.putStack(context.stackPtr - 2,in.getStack(context.stackPtr - 1));
result.putStack(context.stackPtr - 1,in.getStack(context.stackPtr - 2));
result.putStack(context.stackPtr,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.DUP2:
{
SymbolicAddressMap result=in.cloneFilterStack(context.stackPtr);
result.putStack(context.stackPtr,in.getStack(context.stackPtr - 2));
result.putStack(context.stackPtr + 1,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.POP:
case Constants.POP2:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IINC:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IADD:
case Constants.ISUB:
case Constants.INEG:
case Constants.IUSHR:
case Constants.ISHR:
case Constants.IAND:
case Constants.IOR:
case Constants.IXOR:
case Constants.IMUL:
case Constants.IDIV:
case Constants.IREM:
case Constants.ISHL:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.I2B:
case Constants.I2C:
case Constants.I2S:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.MONITORENTER:
retval.put(context.callString,SymbolicAddressMap.TOP);
break;
case Constants.MONITOREXIT:
retval.put(context.callString,SymbolicAddressMap.TOP);
break;
case Constants.CHECKCAST:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.INSTANCEOF:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.NEW:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.NEWARRAY:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.ANEWARRAY:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.MULTIANEWARRAY:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.GOTO:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.IFNULL:
case Constants.IFNONNULL:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IF_ACMPEQ:
case Constants.IF_ACMPNE:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IFEQ:
case Constants.IFNE:
case Constants.IFLT:
case Constants.IFGE:
case Constants.IFLE:
case Constants.IFGT:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.IF_ICMPEQ:
case Constants.IF_ICMPNE:
case Constants.IF_ICMPLT:
case Constants.IF_ICMPGE:
case Constants.IF_ICMPGT:
case Constants.IF_ICMPLE:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.LOOKUPSWITCH:
case Constants.TABLESWITCH:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.INVOKEVIRTUAL:
case Constants.INVOKEINTERFACE:
case Constants.INVOKESTATIC:
case Constants.INVOKESPECIAL:
{
DFAAppInfo p=interpreter.getProgram();
ContextMap<String,String> receivers=p.getReceivers().get(stmt);
if (receivers == null) {
String errMsg=context.method + "String_Node_Str" + instruction.toString(context.constPool.getConstantPool())+ "String_Node_Str";
throw new AssertionError(errMsg);
}
for (Iterator<String> i=receivers.keySet().iterator(); i.hasNext(); ) {
String methodName=i.next();
doInvoke(methodName,stmt,context,input,interpreter,state,retval);
}
}
break;
case Constants.ARETURN:
{
SymbolicAddressMap result=in.cloneFilterStack(0);
result.putStack(0,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
objects.put(stmt,retval);
}
break;
case Constants.RETURN:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IRETURN:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
default :
System.err.println("String_Node_Str" + stmt);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
}
if (DEBUG_PRINT) {
System.out.println("String_Node_Str" + context + "String_Node_Str"+ stmt);
System.out.println("String_Node_Str" + context.stackPtr + "String_Node_Str"+ newStackPtr);
retval.get(context.callString).print(System.out,4);
}
context.stackPtr=newStackPtr;
return retval;
}

Fixed version (ground truth):
public ContextMap<CallString,SymbolicAddressMap> transfer(InstructionHandle stmt,FlowEdge edge,ContextMap<CallString,SymbolicAddressMap> input,Interpreter<CallString,SymbolicAddressMap> interpreter,Map<InstructionHandle,ContextMap<CallString,SymbolicAddressMap>> state){
  Context context=new Context(input.getContext());
  SymbolicAddressMap in=input.get(context.callString);
  ContextMap<CallString,SymbolicAddressMap> retval=new ContextMap<CallString,SymbolicAddressMap>(context,input);
  Instruction instruction=stmt.getInstruction();
  int newStackPtr=context.stackPtr + instruction.produceStack(context.constPool) - instruction.consumeStack(context.constPool);
switch (instruction.getOpcode()) {
case Constants.ICONST_M1:
case Constants.ICONST_0:
case Constants.ICONST_1:
case Constants.ICONST_2:
case Constants.ICONST_3:
case Constants.ICONST_4:
case Constants.ICONST_5:
case Constants.BIPUSH:
case Constants.SIPUSH:
{
      retval.put(context.callString,in.cloneFilterStack(newStackPtr));
    }
  break;
case Constants.ACONST_NULL:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.LDC:
case Constants.LDC_W:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.LDC2_W:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.ISTORE_0:
case Constants.ISTORE_1:
case Constants.ISTORE_2:
case Constants.ISTORE_3:
case Constants.ISTORE:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.ASTORE_0:
case Constants.ASTORE_1:
case Constants.ASTORE_2:
case Constants.ASTORE_3:
case Constants.ASTORE:
{
StoreInstruction instr=(StoreInstruction)instruction;
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
result.putStack(instr.getIndex(),in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.ILOAD_0:
case Constants.ILOAD_1:
case Constants.ILOAD_2:
case Constants.ILOAD_3:
case Constants.ILOAD:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.ALOAD_0:
case Constants.ALOAD_1:
case Constants.ALOAD_2:
case Constants.ALOAD_3:
case Constants.ALOAD:
{
LoadInstruction instr=(LoadInstruction)instruction;
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
result.putStack(context.stackPtr,in.getStack(instr.getIndex()));
retval.put(context.callString,result);
}
break;
case Constants.ARRAYLENGTH:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.PUTFIELD:
{
PUTFIELD instr=(PUTFIELD)instruction;
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
retval.put(context.callString,SymbolicAddressMap.TOP);
}
 else {
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
}
break;
case Constants.GETFIELD:
{
GETFIELD instr=(GETFIELD)instruction;
objects.put(stmt,input);
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
BoundedSet<SymbolicAddress> objectMapping=in.getStack(context.stackPtr - 1);
BoundedSet<SymbolicAddress> newMapping;
if (objectMapping.isSaturated()) {
newMapping=bsFactory.top();
}
 else {
newMapping=bsFactory.empty();
for (SymbolicAddress addr : objectMapping.getSet()) {
newMapping.add(addr.access(instr.getFieldName(context.constPool)));
}
}
result.putStack(context.stackPtr - 1,newMapping);
}
retval.put(context.callString,result);
}
break;
case Constants.PUTSTATIC:
{
PUTSTATIC instr=(PUTSTATIC)instruction;
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
retval.put(context.callString,SymbolicAddressMap.TOP);
}
 else {
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
}
break;
case Constants.GETSTATIC:
{
GETSTATIC instr=(GETSTATIC)instruction;
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
if (instr.getFieldType(context.constPool) instanceof ReferenceType) {
BoundedSet<SymbolicAddress> newMapping=bsFactory.empty();
newMapping.add(SymbolicAddress.staticField(instr.getFieldName(context.constPool)));
result.putStack(context.stackPtr,newMapping);
}
retval.put(context.callString,result);
}
break;
case Constants.IASTORE:
case Constants.CASTORE:
case Constants.SASTORE:
case Constants.BASTORE:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.AASTORE:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.IALOAD:
case Constants.CALOAD:
case Constants.SALOAD:
case Constants.BALOAD:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.AALOAD:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.DUP:
{
SymbolicAddressMap result=in.cloneFilterStack(newStackPtr);
result.putStack(context.stackPtr,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.DUP_X1:
{
SymbolicAddressMap result=in.cloneFilterStack(context.stackPtr - 2);
result.putStack(context.stackPtr - 2,in.getStack(context.stackPtr - 1));
result.putStack(context.stackPtr - 1,in.getStack(context.stackPtr - 2));
result.putStack(context.stackPtr,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.DUP2:
{
SymbolicAddressMap result=in.cloneFilterStack(context.stackPtr);
result.putStack(context.stackPtr,in.getStack(context.stackPtr - 2));
result.putStack(context.stackPtr + 1,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
}
break;
case Constants.POP:
case Constants.POP2:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IINC:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IADD:
case Constants.ISUB:
case Constants.INEG:
case Constants.IUSHR:
case Constants.ISHR:
case Constants.IAND:
case Constants.IOR:
case Constants.IXOR:
case Constants.IMUL:
case Constants.IDIV:
case Constants.IREM:
case Constants.ISHL:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.I2B:
case Constants.I2C:
case Constants.I2S:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.MONITORENTER:
retval.put(context.callString,SymbolicAddressMap.TOP);
break;
case Constants.MONITOREXIT:
retval.put(context.callString,SymbolicAddressMap.TOP);
break;
case Constants.CHECKCAST:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.INSTANCEOF:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.NEW:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.NEWARRAY:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.ANEWARRAY:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.MULTIANEWARRAY:
{
retval.put(context.callString,SymbolicAddressMap.TOP);
}
break;
case Constants.GOTO:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.IFNULL:
case Constants.IFNONNULL:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IF_ACMPEQ:
case Constants.IF_ACMPNE:
{
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IFEQ:
case Constants.IFNE:
case Constants.IFLT:
case Constants.IFGE:
case Constants.IFLE:
case Constants.IFGT:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.IF_ICMPEQ:
case Constants.IF_ICMPNE:
case Constants.IF_ICMPLT:
case Constants.IF_ICMPGE:
case Constants.IF_ICMPGT:
case Constants.IF_ICMPLE:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.LOOKUPSWITCH:
case Constants.TABLESWITCH:
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
case Constants.INVOKEVIRTUAL:
case Constants.INVOKEINTERFACE:
case Constants.INVOKESTATIC:
case Constants.INVOKESPECIAL:
{
DFAAppInfo p=interpreter.getProgram();
ContextMap<String,String> receivers=p.getReceivers().get(stmt);
if (receivers == null) {
String errMsg=context.method + "String_Node_Str" + instruction.toString(context.constPool.getConstantPool())+ "String_Node_Str";
throw new AssertionError(errMsg);
}
for (Iterator<String> i=receivers.keySet().iterator(); i.hasNext(); ) {
String methodName=i.next();
doInvoke(methodName,stmt,context,input,interpreter,state,retval);
}
}
break;
case Constants.ARETURN:
{
SymbolicAddressMap result=in.cloneFilterStack(0);
result.putStack(0,in.getStack(context.stackPtr - 1));
retval.put(context.callString,result);
objects.put(stmt,retval);
}
break;
case Constants.RETURN:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
case Constants.IRETURN:
{
objects.put(stmt,input);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
}
break;
default :
System.err.println("String_Node_Str" + stmt);
retval.put(context.callString,in.cloneFilterStack(newStackPtr));
break;
}
if (DEBUG_PRINT) {
System.out.println("String_Node_Str" + context + "String_Node_Str"+ stmt);
System.out.println("String_Node_Str" + context.stackPtr + "String_Node_Str"+ newStackPtr);
System.out.println("String_Node_Str");
input.get(context.callString).print(System.out,4);
System.out.println("String_Node_Str");
retval.get(context.callString).print(System.out,4);
}
context.stackPtr=newStackPtr;
return retval;
}