Program: 85904
Project: 85904
Buggy source:
/** 
 * Throws an exception if the blocks difficulty is not correct.
 */
private void checkDifficultyTransitions(StoredBlock storedPrev,Block nextBlock) throws BlockStoreException, VerificationException {
  Block prev=storedPrev.getHeader();
  if ((storedPrev.getHeight() + 1) % params.interval != 0) {
    if (params.getId().equals(NetworkParameters.ID_TESTNET) && nextBlock.getTime().after(testnetDiffDate)) {
      checkTestnetDifficulty(storedPrev,prev,nextBlock);
      return;
    }
    if (nextBlock.getDifficultyTarget() != prev.getDifficultyTarget())     throw new VerificationException("String_Node_Str" + storedPrev.getHeight() + "String_Node_Str"+ Long.toHexString(nextBlock.getDifficultyTarget())+ "String_Node_Str"+ Long.toHexString(prev.getDifficultyTarget()));
    return;
  }
  long now=System.currentTimeMillis();
  StoredBlock cursor=blockStore.get(prev.getHash());
  for (int i=0; i < params.interval - 1; i++) {
    if (cursor == null) {
      throw new VerificationException("String_Node_Str");
    }
    cursor=blockStore.get(cursor.getHeader().getPrevBlockHash());
  }
  log.info("String_Node_Str",System.currentTimeMillis() - now);
  Block blockIntervalAgo=cursor.getHeader();
  int timespan=(int)(prev.getTimeSeconds() - blockIntervalAgo.getTimeSeconds());
  if (timespan < params.targetTimespan / 4)   timespan=params.targetTimespan / 4;
  if (timespan > params.targetTimespan * 4)   timespan=params.targetTimespan * 4;
  BigInteger newDifficulty=Utils.decodeCompactBits(blockIntervalAgo.getDifficultyTarget());
  newDifficulty=newDifficulty.multiply(BigInteger.valueOf(timespan));
  newDifficulty=newDifficulty.divide(BigInteger.valueOf(params.targetTimespan));
  if (newDifficulty.compareTo(params.proofOfWorkLimit) > 0) {
    log.info("String_Node_Str",newDifficulty.toString(16));
    newDifficulty=params.proofOfWorkLimit;
  }
  int accuracyBytes=(int)(nextBlock.getDifficultyTarget() >>> 24) - 3;
  BigInteger receivedDifficulty=nextBlock.getDifficultyTargetAsInteger();
  BigInteger mask=BigInteger.valueOf(0xFFFFFFL).shiftLeft(accuracyBytes * 8);
  newDifficulty=newDifficulty.and(mask);
  if (newDifficulty.compareTo(receivedDifficulty) != 0)   throw new VerificationException("String_Node_Str" + receivedDifficulty.toString(16) + "String_Node_Str"+ newDifficulty.toString(16));
}

Fixed version (ground truth):
/** 
 * Throws an exception if the blocks difficulty is not correct.
 */
private void checkDifficultyTransitions(StoredBlock storedPrev,Block nextBlock) throws BlockStoreException, VerificationException {
  Block prev=storedPrev.getHeader();
  if ((storedPrev.getHeight() + 1) % params.interval != 0) {
    if (params.getId().equals(NetworkParameters.ID_TESTNET) && nextBlock.getTime().after(testnetDiffDate)) {
      checkTestnetDifficulty(storedPrev,prev,nextBlock);
      return;
    }
    if (nextBlock.getDifficultyTarget() != prev.getDifficultyTarget())     throw new VerificationException("String_Node_Str" + storedPrev.getHeight() + "String_Node_Str"+ Long.toHexString(nextBlock.getDifficultyTarget())+ "String_Node_Str"+ Long.toHexString(prev.getDifficultyTarget()));
    return;
  }
  long now=System.currentTimeMillis();
  StoredBlock cursor=blockStore.get(prev.getHash());
  for (int i=0; i < params.interval - 1; i++) {
    if (cursor == null) {
      throw new VerificationException("String_Node_Str");
    }
    cursor=blockStore.get(cursor.getHeader().getPrevBlockHash());
  }
  log.info("String_Node_Str",System.currentTimeMillis() - now);
  Block blockIntervalAgo=cursor.getHeader();
  int timespan=(int)(prev.getTimeSeconds() - blockIntervalAgo.getTimeSeconds());
  if (timespan < params.targetTimespan / 4)   timespan=params.targetTimespan / 4;
  if (timespan > params.targetTimespan * 4)   timespan=params.targetTimespan * 4;
  BigInteger newDifficulty=Utils.decodeCompactBits(prev.getDifficultyTarget());
  newDifficulty=newDifficulty.multiply(BigInteger.valueOf(timespan));
  newDifficulty=newDifficulty.divide(BigInteger.valueOf(params.targetTimespan));
  if (newDifficulty.compareTo(params.proofOfWorkLimit) > 0) {
    log.info("String_Node_Str",newDifficulty.toString(16));
    newDifficulty=params.proofOfWorkLimit;
  }
  int accuracyBytes=(int)(nextBlock.getDifficultyTarget() >>> 24) - 3;
  BigInteger receivedDifficulty=nextBlock.getDifficultyTargetAsInteger();
  BigInteger mask=BigInteger.valueOf(0xFFFFFFL).shiftLeft(accuracyBytes * 8);
  newDifficulty=newDifficulty.and(mask);
  if (newDifficulty.compareTo(receivedDifficulty) != 0)   throw new VerificationException("String_Node_Str" + receivedDifficulty.toString(16) + "String_Node_Str"+ newDifficulty.toString(16));
}