Program: 169268
Project: 169268
Buggy source:
public Pair<Double,Integer> getFullScore(int[][] allKmerHashes,SequenceMinHashes s){
  if (allKmerHashes == null)   throw new FastAlignRuntimeException("String_Node_Str");
  int[][] sAllKmerHashes=s.getFullHashes();
  int valid1Lower=0;
  int valid1Upper=allKmerHashes.length;
  int valid2Lower=0;
  int valid2Upper=sAllKmerHashes.length;
  int overlapSize=0;
  int border=MAX_SHIFT_ALLOWED;
  int count=0;
  int shift=0;
  int[] posShift=new int[Math.min(allKmerHashes.length,sAllKmerHashes.length)];
  for (int repeat=0; repeat < NUM_SCORING_REPEATS; repeat++) {
    count=0;
    int iter1=0;
    int iter2=0;
    while (iter1 < valid1Upper && iter2 < valid2Upper) {
      int[] s1=allKmerHashes[iter1];
      int[] s2=sAllKmerHashes[iter2];
      if (s1[0] < s2[0] || s1[1] < valid1Lower || s1[1] >= valid1Upper)       iter1++;
 else       if (s2[0] < s1[0] || s2[1] < valid2Lower || s2[1] >= valid2Upper)       iter2++;
 else {
        posShift[count]=s2[1] - s1[1];
        count++;
        iter1++;
        iter2++;
      }
    }
    if (count > 0) {
      shift=Utils.quickSelect(posShift,count / 2,count);
    }
 else     shift=0;
    valid1Lower=Math.max(0,-shift - border);
    valid1Upper=Math.min(allKmerHashes.length,sAllKmerHashes.length - shift + border);
    valid2Lower=Math.max(0,shift - border);
    valid2Upper=Math.min(sAllKmerHashes.length,allKmerHashes.length + shift + border);
    int valid2LowerBorder=Math.max(0,shift);
    int valid2UpperBorder=Math.min(sAllKmerHashes.length,allKmerHashes.length + shift);
    overlapSize=valid2UpperBorder - valid2LowerBorder;
  }
  int validCount=0;
  for (int iter=0; iter < count; iter++) {
    if (Math.abs(posShift[iter] - shift) <= MAX_SHIFT_ALLOWED)     validCount++;
  }
  double validShiftPercent=(double)validCount / (double)count;
  double score=0;
  if (overlapSize > 0 && validShiftPercent > SHIFT_CONSENSUS_PERCENTAGE)   score=(double)count / (double)(overlapSize);
  return new Pair<Double,Integer>(score,shift);
}

Fixed version (ground truth):
public Pair<Double,Integer> getFullScore(int[][] allKmerHashes,SequenceMinHashes s,int maxShift){
  if (allKmerHashes == null)   throw new FastAlignRuntimeException("String_Node_Str");
  int[][] sAllKmerHashes=s.getFullHashes();
  int valid1Lower=0;
  int valid1Upper=allKmerHashes.length;
  int valid2Lower=0;
  int valid2Upper=sAllKmerHashes.length;
  int overlapSize=0;
  int border=maxShift;
  int count=0;
  int shift=0;
  int[] posShift=new int[Math.min(allKmerHashes.length,sAllKmerHashes.length)];
  int numScoringRepeats=2;
  if (maxShift <= 0)   numScoringRepeats=1;
  maxShift=Math.abs(maxShift);
  for (int repeat=0; repeat < numScoringRepeats; repeat++) {
    count=0;
    int iter1=0;
    int iter2=0;
    while (iter1 < allKmerHashes.length && iter2 < sAllKmerHashes.length) {
      int[] s1=allKmerHashes[iter1];
      int[] s2=sAllKmerHashes[iter2];
      if (s1[0] < s2[0] || s1[1] < valid1Lower || s1[1] >= valid1Upper)       iter1++;
 else       if (s2[0] < s1[0] || s2[1] < valid2Lower || s2[1] >= valid2Upper)       iter2++;
 else {
        posShift[count]=s2[1] - s1[1];
        count++;
        iter1++;
        iter2++;
      }
    }
    if (count > 0) {
      shift=Utils.quickSelect(posShift,count / 2,count);
    }
 else     shift=0;
    valid1Lower=Math.max(0,-shift - border);
    valid1Upper=Math.min(allKmerHashes.length,sAllKmerHashes.length - shift + border);
    valid2Lower=Math.max(0,shift - border);
    valid2Upper=Math.min(sAllKmerHashes.length,allKmerHashes.length + shift + border);
    int valid2LowerBorder=Math.max(0,shift);
    int valid2UpperBorder=Math.min(sAllKmerHashes.length,allKmerHashes.length + shift);
    overlapSize=valid2UpperBorder - valid2LowerBorder;
  }
  int validCount=0;
  for (int iter=0; iter < count; iter++) {
    if (Math.abs(posShift[iter] - shift) <= maxShift)     validCount++;
  }
  double validShiftPercent=(double)validCount / (double)count;
  double score=0;
  if (overlapSize > 0 && validShiftPercent > SHIFT_CONSENSUS_PERCENTAGE)   score=(double)count / (double)(overlapSize);
  return new Pair<Double,Integer>(score,shift);
}