Program: 85808
Project: 85808
Buggy source:
private static int executeMultiSig(Transaction txContainingThis,int index,Script script,LinkedList<byte[]> stack,int opCount,int lastCodeSepLocation,int opcode) throws ScriptException {
  if (stack.size() < 2)   throw new ScriptException("String_Node_Str");
  int pubKeyCount=castToBigInteger(stack.pollLast()).intValue();
  if (pubKeyCount < 0 || pubKeyCount > 20)   throw new ScriptException("String_Node_Str");
  opCount+=pubKeyCount;
  if (opCount > 201)   throw new ScriptException("String_Node_Str");
  if (stack.size() < pubKeyCount + 1)   throw new ScriptException("String_Node_Str");
  LinkedList<byte[]> pubkeys=new LinkedList<byte[]>();
  for (int i=0; i < pubKeyCount; i++)   pubkeys.add(stack.pollLast());
  int sigCount=castToBigInteger(stack.pollLast()).intValue();
  if (sigCount < 0 || sigCount > pubKeyCount)   throw new ScriptException("String_Node_Str");
  if (stack.size() < sigCount + 1)   throw new ScriptException("String_Node_Str");
  LinkedList<byte[]> sigs=new LinkedList<byte[]>();
  for (int i=0; i < sigCount; i++)   sigs.add(stack.pollLast());
  byte[] prog=script.getProgram();
  byte[] connectedScript=Arrays.copyOfRange(prog,lastCodeSepLocation,prog.length);
  for (  byte[] sig : sigs) {
    UnsafeByteArrayOutputStream outStream=new UnsafeByteArrayOutputStream(sig.length + 1);
    try {
      writeBytes(outStream,sig);
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    connectedScript=removeAllInstancesOf(connectedScript,outStream.toByteArray());
  }
  boolean valid=true;
  while (sigs.size() > 0) {
    byte[] sig=sigs.getFirst();
    byte[] pubKey=pubkeys.pollFirst();
    Sha256Hash hash=txContainingThis.hashTransactionForSignature(index,connectedScript,sig[sig.length - 1]);
    try {
      if (ECKey.verify(hash.getBytes(),Arrays.copyOf(sig,sig.length - 1),pubKey))       sigs.pollFirst();
    }
 catch (    Exception e) {
    }
    if (sigs.size() > pubkeys.size()) {
      valid=false;
      break;
    }
  }
  stack.pollLast();
  if (opcode == OP_CHECKMULTISIG) {
    stack.add(valid ? new byte[]{1} : new byte[]{0});
  }
 else   if (opcode == OP_CHECKMULTISIGVERIFY) {
    if (!valid)     throw new ScriptException("String_Node_Str");
  }
  return opCount;
}

Fixed version (ground truth):
private static int executeMultiSig(Transaction txContainingThis,int index,Script script,LinkedList<byte[]> stack,int opCount,int lastCodeSepLocation,int opcode) throws ScriptException {
  if (stack.size() < 2)   throw new ScriptException("String_Node_Str");
  int pubKeyCount=castToBigInteger(stack.pollLast()).intValue();
  if (pubKeyCount < 0 || pubKeyCount > 20)   throw new ScriptException("String_Node_Str");
  opCount+=pubKeyCount;
  if (opCount > 201)   throw new ScriptException("String_Node_Str");
  if (stack.size() < pubKeyCount + 1)   throw new ScriptException("String_Node_Str");
  LinkedList<byte[]> pubkeys=new LinkedList<byte[]>();
  for (int i=0; i < pubKeyCount; i++) {
    byte[] pubKey=stack.pollLast();
    if (pubKey.length == 0)     throw new ScriptException("String_Node_Str");
    pubkeys.add(pubKey);
  }
  int sigCount=castToBigInteger(stack.pollLast()).intValue();
  if (sigCount < 0 || sigCount > pubKeyCount)   throw new ScriptException("String_Node_Str");
  if (stack.size() < sigCount + 1)   throw new ScriptException("String_Node_Str");
  LinkedList<byte[]> sigs=new LinkedList<byte[]>();
  for (int i=0; i < sigCount; i++) {
    byte[] sig=stack.pollLast();
    if (sig.length == 0)     throw new ScriptException("String_Node_Str");
    sigs.add(sig);
  }
  byte[] prog=script.getProgram();
  byte[] connectedScript=Arrays.copyOfRange(prog,lastCodeSepLocation,prog.length);
  for (  byte[] sig : sigs) {
    UnsafeByteArrayOutputStream outStream=new UnsafeByteArrayOutputStream(sig.length + 1);
    try {
      writeBytes(outStream,sig);
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    connectedScript=removeAllInstancesOf(connectedScript,outStream.toByteArray());
  }
  boolean valid=true;
  while (sigs.size() > 0) {
    byte[] sig=sigs.getFirst();
    byte[] pubKey=pubkeys.pollFirst();
    Sha256Hash hash=txContainingThis.hashTransactionForSignature(index,connectedScript,sig[sig.length - 1]);
    try {
      if (ECKey.verify(hash.getBytes(),Arrays.copyOf(sig,sig.length - 1),pubKey))       sigs.pollFirst();
    }
 catch (    Exception e) {
    }
    if (sigs.size() > pubkeys.size()) {
      valid=false;
      break;
    }
  }
  stack.pollLast();
  if (opcode == OP_CHECKMULTISIG) {
    stack.add(valid ? new byte[]{1} : new byte[]{0});
  }
 else   if (opcode == OP_CHECKMULTISIGVERIFY) {
    if (!valid)     throw new ScriptException("String_Node_Str");
  }
  return opCount;
}