Program: 61567
Project: 61567
Buggy source:
public AVM2Code(ABCInputStream ais) throws IOException {
  Map<Long,AVM2Instruction> codeMap=new TreeMap<>();
  Map<Long,Long> endOffsets=new HashMap<>();
  DumpInfo diParent=ais.dumpInfo;
  List<Long> addresses=new ArrayList<>();
  long startPos=ais.getPosition();
  addresses.add(startPos);
  while (!addresses.isEmpty()) {
    long address=addresses.remove(0);
    if (codeMap.containsKey(address)) {
      continue;
    }
    if (address < startPos) {
      continue;
    }
    try {
      ais.seek(address);
      while (ais.available() > 0) {
        DumpInfo di=ais.newDumpLevel("String_Node_Str","String_Node_Str");
        long startOffset=ais.getPosition();
        int instructionCode=ais.read("String_Node_Str");
        InstructionDefinition instr=instructionSet[instructionCode];
        if (di != null) {
          di.name=instr.instructionName;
        }
        if (instr != null) {
          int[] actualOperands=null;
          if (instructionCode == 0x1b) {
            int firstOperand=ais.readS24("String_Node_Str");
            int case_count=ais.readU30("String_Node_Str");
            actualOperands=new int[case_count + 3];
            actualOperands[0]=firstOperand;
            actualOperands[1]=case_count;
            for (int c=0; c < case_count + 1; c++) {
              actualOperands[2 + c]=ais.readS24("String_Node_Str");
            }
          }
 else {
            if (instr.operands.length > 0) {
              actualOperands=new int[instr.operands.length];
              for (int op=0; op < instr.operands.length; op++) {
switch (instr.operands[op] & 0xff00) {
case OPT_U30:
                  actualOperands[op]=ais.readU30("String_Node_Str");
                break;
case OPT_U8:
              actualOperands[op]=ais.read("String_Node_Str");
            break;
case OPT_BYTE:
          actualOperands[op]=(byte)ais.read("String_Node_Str");
        break;
case OPT_S24:
      actualOperands[op]=ais.readS24("String_Node_Str");
    break;
}
}
}
}
if (instr instanceof IfTypeIns) {
long target=ais.getPosition() + actualOperands[0];
addresses.add(target);
}
codeMap.put(startOffset,new AVM2Instruction(startOffset,instr,actualOperands));
ais.endDumpLevel(instr.instructionCode);
long endOffset=ais.getPosition();
endOffsets.put(startOffset,endOffset);
if (instr.isExitInstruction()) {
break;
}
}
 else {
ais.endDumpLevel();
break;
}
}
}
 catch (EndOfStreamException ex) {
ais.endDumpLevelUntil(diParent);
}
}
List<Long> starts=new ArrayList<>(new TreeSet<>(codeMap.keySet()));
for (int s=0; s < starts.size() - 1; s++) {
long curEnd=endOffsets.get(starts.get(s));
if (!codeMap.containsKey(curEnd)) {
long nextStart=starts.get(s + 1);
for (long off=curEnd; off < nextStart; off++) {
codeMap.put(off,new AVM2Instruction(off,new NopIns(),new int[]{}));
}
}
}
code.addAll(codeMap.values());
}

Fixed version (ground truth):
public AVM2Code(ABCInputStream ais) throws IOException {
  Map<Long,AVM2Instruction> codeMap=new TreeMap<>();
  Map<Long,Long> endOffsets=new HashMap<>();
  DumpInfo diParent=ais.dumpInfo;
  List<Long> addresses=new ArrayList<>();
  long startPos=ais.getPosition();
  addresses.add(startPos);
  while (!addresses.isEmpty()) {
    long address=addresses.remove(0);
    boolean afterExit=false;
    if (codeMap.containsKey(address)) {
      continue;
    }
    if (address < startPos) {
      continue;
    }
    try {
      ais.seek(address);
      while (ais.available() > 0) {
        DumpInfo di=ais.newDumpLevel("String_Node_Str","String_Node_Str");
        long startOffset=ais.getPosition();
        int instructionCode=ais.read("String_Node_Str");
        InstructionDefinition instr=instructionSet[instructionCode];
        if (di != null) {
          di.name=instr.instructionName;
        }
        if (instr != null) {
          int[] actualOperands=null;
          if (instructionCode == 0x1b) {
            int firstOperand=ais.readS24("String_Node_Str");
            int case_count=ais.readU30("String_Node_Str");
            actualOperands=new int[case_count + 3];
            actualOperands[0]=firstOperand;
            actualOperands[1]=case_count;
            for (int c=0; c < case_count + 1; c++) {
              actualOperands[2 + c]=ais.readS24("String_Node_Str");
            }
          }
 else {
            if (instr.operands.length > 0) {
              actualOperands=new int[instr.operands.length];
              for (int op=0; op < instr.operands.length; op++) {
switch (instr.operands[op] & 0xff00) {
case OPT_U30:
                  actualOperands[op]=ais.readU30("String_Node_Str");
                break;
case OPT_U8:
              actualOperands[op]=ais.read("String_Node_Str");
            break;
case OPT_BYTE:
          actualOperands[op]=(byte)ais.read("String_Node_Str");
        break;
case OPT_S24:
      actualOperands[op]=ais.readS24("String_Node_Str");
    break;
}
}
}
}
if (!afterExit && (instr instanceof IfTypeIns)) {
long target=ais.getPosition() + actualOperands[0];
addresses.add(target);
}
codeMap.put(startOffset,new AVM2Instruction(startOffset,instr,actualOperands));
ais.endDumpLevel(instr.instructionCode);
long endOffset=ais.getPosition();
endOffsets.put(startOffset,endOffset);
if (instr.isExitInstruction()) {
afterExit=true;
}
}
 else {
ais.endDumpLevel();
break;
}
}
}
 catch (EndOfStreamException ex) {
ais.endDumpLevelUntil(diParent);
}
}
code.addAll(codeMap.values());
}