Program: 6263
Project: 6263
Buggy source:
/** 
 * Called recursive to build the VTs top down.
 * @param clazz
 */
private void buildVT(JavaClass clazz){
  int i, j;
  JopClassInfo cli;
  cli=(JopClassInfo)ai.cliMap.get(clazz.getClassName());
  JopClassInfo.ClVT supVt=null;
  JopClassInfo.ClFT supFt=null;
  if (clazz.getClassName().equals(clazz.getSuperclassName())) {
    ;
  }
 else {
    ClassInfo clisup=(ClassInfo)ai.cliMap.get(clazz.getSuperclassName());
    JavaClass superClazz=clisup.clazz;
    String superName=superClazz.getClassName();
    if (mapClVT.get(superName) == null) {
      buildVT(superClazz);
    }
    supVt=(JopClassInfo.ClVT)mapClVT.get(superName);
    supFt=(JopClassInfo.ClFT)mapClFT.get(superName);
  }
  String clazzName=clazz.getClassName();
  if (mapClVT.get(clazzName) != null) {
    return;
  }
  JopClassInfo.ClVT clvt=cli.getClVT();
  JopClassInfo.ClFT clft=cli.getClFT();
  mapClVT.put(clazzName,clvt);
  mapClFT.put(clazzName,clft);
  Method m[]=clazz.getMethods();
  int methodCount=m.length;
  int maxLen=methodCount;
  if (supVt != null)   maxLen+=supVt.len;
  clvt.len=0;
  clvt.key=new String[maxLen];
  clvt.mi=new JopMethodInfo[maxLen];
  Field f[]=clazz.getFields();
  maxLen=f.length;
  clft.len=0;
  clft.key=new String[maxLen];
  clft.idx=new int[maxLen];
  clft.size=new int[maxLen];
  clft.isStatic=new boolean[maxLen];
  clft.isReference=new boolean[maxLen];
  if (supVt != null) {
    for (i=0; i < supVt.len; ++i) {
      clvt.key[i]=supVt.key[i];
      clvt.mi[i]=supVt.mi[i];
    }
    clvt.len=supVt.len;
  }
  for (i=0; i < methodCount; i++) {
    Method meth=m[i];
    String methodId=meth.getName() + meth.getSignature();
    JopMethodInfo mi=(JopMethodInfo)cli.getMethodInfo(methodId);
    for (j=0; j < clvt.len; ++j) {
      if (clvt.key[j].equals(methodId)) {
        clvt.mi[j]=mi;
        break;
      }
    }
    if (j == clvt.len) {
      clvt.key[clvt.len]=methodId;
      clvt.mi[clvt.len]=mi;
      ++clvt.len;
    }
  }
  int nextFieldIndex=0;
  int nextStaticIndex=0;
  if (supFt != null) {
    nextFieldIndex=supFt.instSize;
    for (i=0; i < supFt.len; ++i) {
      if (supFt.isStatic[i]) {
        if (supFt.idx[i] >= nextStaticIndex) {
          nextStaticIndex=supFt.idx[i] + 1;
        }
      }
    }
  }
  for (i=0; i < f.length; ++i) {
    Field field=f[i];
    int size=field.getType().getSize();
    String fieldId=field.getName() + field.getSignature();
    clft.key[clft.len]=fieldId;
    clft.size[clft.len]=size;
    clft.isReference[clft.len]=field.getType() instanceof ReferenceType;
    if (field.isStatic()) {
      clft.idx[clft.len]=nextStaticIndex;
      clft.isStatic[clft.len]=true;
      nextStaticIndex+=size;
    }
 else {
      clft.idx[clft.len]=nextFieldIndex;
      clft.isStatic[clft.len]=false;
      nextFieldIndex+=size;
    }
    clft.len++;
  }
  clft.instSize=nextFieldIndex;
  cli.setInstanceSize(nextFieldIndex);
}

Fixed version (ground truth):
/** 
 * Called recursive to build the VTs top down.
 * @param clazz
 */
private void buildVT(JavaClass clazz){
  int i, j;
  JopClassInfo cli;
  cli=(JopClassInfo)ai.cliMap.get(clazz.getClassName());
  JopClassInfo.ClVT supVt=null;
  JopClassInfo.ClFT supFt=null;
  if (clazz.getClassName().equals(clazz.getSuperclassName())) {
    ;
  }
 else {
    ClassInfo clisup=(ClassInfo)ai.cliMap.get(clazz.getSuperclassName());
    JavaClass superClazz=clisup.clazz;
    String superName=superClazz.getClassName();
    if (mapClVT.get(superName) == null) {
      buildVT(superClazz);
    }
    supVt=(JopClassInfo.ClVT)mapClVT.get(superName);
    supFt=(JopClassInfo.ClFT)mapClFT.get(superName);
  }
  String clazzName=clazz.getClassName();
  if (mapClVT.get(clazzName) != null) {
    return;
  }
  JopClassInfo.ClVT clvt=cli.getClVT();
  JopClassInfo.ClFT clft=cli.getClFT();
  mapClVT.put(clazzName,clvt);
  mapClFT.put(clazzName,clft);
  Method m[]=clazz.getMethods();
  int methodCount=m.length;
  int maxLen=methodCount;
  if (supVt != null)   maxLen+=supVt.len;
  for (  JavaClass cl : clazz.getInterfaces()) {
    maxLen+=cl.getMethods().length;
  }
  clvt.len=0;
  clvt.key=new String[maxLen];
  clvt.mi=new JopMethodInfo[maxLen];
  Field f[]=clazz.getFields();
  maxLen=f.length;
  clft.len=0;
  clft.key=new String[maxLen];
  clft.idx=new int[maxLen];
  clft.size=new int[maxLen];
  clft.isStatic=new boolean[maxLen];
  clft.isReference=new boolean[maxLen];
  if (supVt != null) {
    for (i=0; i < supVt.len; ++i) {
      clvt.key[i]=supVt.key[i];
      clvt.mi[i]=supVt.mi[i];
    }
    clvt.len=supVt.len;
  }
  for (i=0; i < methodCount; i++) {
    Method meth=m[i];
    String methodId=meth.getName() + meth.getSignature();
    JopMethodInfo mi=(JopMethodInfo)cli.getMethodInfo(methodId);
    for (j=0; j < clvt.len; ++j) {
      if (clvt.key[j].equals(methodId)) {
        clvt.mi[j]=mi;
        break;
      }
    }
    if (j == clvt.len) {
      clvt.key[clvt.len]=methodId;
      clvt.mi[clvt.len]=mi;
      ++clvt.len;
    }
  }
  for (i=0; i < clazz.getInterfaces().length; i++) {
    ClassInfo icli=ai.cliMap.get(clazz.getInterfaces()[i].getClassName());
    for (    String methodId : icli.methods.keySet()) {
      for (j=0; j < clvt.len; ++j) {
        if (clvt.key[j].equals(methodId)) {
          break;
        }
      }
      if (j == clvt.len) {
        clvt.key[clvt.len]=methodId;
        clvt.mi[clvt.len]=(JopMethodInfo)icli.methods.get(methodId);
        ++clvt.len;
      }
    }
  }
  int nextFieldIndex=0;
  int nextStaticIndex=0;
  if (supFt != null) {
    nextFieldIndex=supFt.instSize;
    for (i=0; i < supFt.len; ++i) {
      if (supFt.isStatic[i]) {
        if (supFt.idx[i] >= nextStaticIndex) {
          nextStaticIndex=supFt.idx[i] + 1;
        }
      }
    }
  }
  for (i=0; i < f.length; ++i) {
    Field field=f[i];
    int size=field.getType().getSize();
    String fieldId=field.getName() + field.getSignature();
    clft.key[clft.len]=fieldId;
    clft.size[clft.len]=size;
    clft.isReference[clft.len]=field.getType() instanceof ReferenceType;
    if (field.isStatic()) {
      clft.idx[clft.len]=nextStaticIndex;
      clft.isStatic[clft.len]=true;
      nextStaticIndex+=size;
    }
 else {
      clft.idx[clft.len]=nextFieldIndex;
      clft.isStatic[clft.len]=false;
      nextFieldIndex+=size;
    }
    clft.len++;
  }
  clft.instSize=nextFieldIndex;
  cli.setInstanceSize(nextFieldIndex);
}