Program: 35064
Project: 35064
Buggy source:
@Override public CoinDataResult getCoinData(byte[] address,Na amount,int size) throws NulsException {
  CoinDataResult coinDataResult=new CoinDataResult();
  List<Coin> rawCoinList=storageService.getCoinList(address);
  List<Coin> coinList=new ArrayList<>();
  if (coinList.isEmpty()) {
    coinDataResult.setEnough(false);
    return coinDataResult;
  }
  Collections.sort(coinList,CoinComparator.getInstance());
  Set<byte[]> usedKeyset=getTmpUsedCoinKeySet();
  for (  Coin coin : rawCoinList) {
    if (!usedKeyset.contains(coin.getOwner())) {
      coinList.add(coin);
    }
  }
  boolean enough=false;
  List<Coin> coins=new ArrayList<>();
  Na values=Na.ZERO;
  for (int i=0; i < coinList.size(); i++) {
    Coin coin=coinList.get(i);
    if (!coin.usable()) {
      continue;
    }
    coins.add(coin);
    size+=coin.size();
    if (i == 127) {
      size+=1;
    }
    Na fee=TransactionFeeCalculator.getFee(size);
    values=values.add(coin.getNa());
    if (values.isGreaterOrEquals(amount.add(fee))) {
      Na change=values.subtract(amount.add(fee));
      if (change.isGreaterThan(Na.ZERO)) {
        Coin changeCoin=new Coin();
        changeCoin.setOwner(address);
        changeCoin.setNa(change);
        fee=TransactionFeeCalculator.getFee(size + changeCoin.size());
        if (amount.add(fee).isLessThan(values)) {
          continue;
        }
        coinDataResult.setChange(changeCoin);
      }
      enough=true;
      coinDataResult.setEnough(true);
      coinDataResult.setFee(fee);
      coinDataResult.setCoinList(coins);
      break;
    }
  }
  if (!enough) {
    coinDataResult.setEnough(false);
    return coinDataResult;
  }
  return coinDataResult;
}

Fixed version (ground truth):
@Override public CoinDataResult getCoinData(byte[] address,Na amount,int size) throws NulsException {
  CoinDataResult coinDataResult=new CoinDataResult();
  List<Coin> rawCoinList=storageService.getCoinList(address);
  List<Coin> coinList=new ArrayList<>();
  if (rawCoinList.isEmpty()) {
    coinDataResult.setEnough(false);
    return coinDataResult;
  }
  Collections.sort(rawCoinList,CoinComparator.getInstance());
  Set<byte[]> usedKeyset=getTmpUsedCoinKeySet();
  for (  Coin coin : rawCoinList) {
    if (!usedKeyset.contains(coin.getOwner())) {
      coinList.add(coin);
    }
  }
  boolean enough=false;
  List<Coin> coins=new ArrayList<>();
  Na values=Na.ZERO;
  for (int i=0; i < coinList.size(); i++) {
    Coin coin=coinList.get(i);
    if (!coin.usable()) {
      continue;
    }
    coins.add(coin);
    size+=coin.size();
    if (i == 127) {
      size+=1;
    }
    Na fee=TransactionFeeCalculator.getFee(size);
    values=values.add(coin.getNa());
    if (values.isGreaterOrEquals(amount.add(fee))) {
      Na change=values.subtract(amount.add(fee));
      if (change.isGreaterThan(Na.ZERO)) {
        Coin changeCoin=new Coin();
        changeCoin.setOwner(address);
        changeCoin.setNa(change);
        fee=TransactionFeeCalculator.getFee(size + changeCoin.size());
        if (amount.add(fee).isLessThan(values)) {
          continue;
        }
        coinDataResult.setChange(changeCoin);
      }
      enough=true;
      coinDataResult.setEnough(true);
      coinDataResult.setFee(fee);
      coinDataResult.setCoinList(coins);
      break;
    }
  }
  if (!enough) {
    coinDataResult.setEnough(false);
    return coinDataResult;
  }
  return coinDataResult;
}