Program: 30773
Project: 30773
Buggy source:
public void applyTransitionIndexToSymbolMapReaders(long pTransitionIndex){
  final int columnCount=Unsafe.getUnsafe().getInt(pTransitionIndex + 4);
  final long index=pTransitionIndex + 8;
  final long stateAddress=index + columnCount * 8;
  if (columnCount > this.columnCount) {
    symbolMapReaders.setPos(columnCount);
  }
  Unsafe.getUnsafe().setMemory(stateAddress,columnCount,(byte)0);
  for (int i=0; i < columnCount; i++) {
    if (Unsafe.getUnsafe().getByte(stateAddress + i) == -1) {
      continue;
    }
    Unsafe.getUnsafe().putByte(stateAddress + i,(byte)-1);
    int copyFrom=Unsafe.getUnsafe().getInt(index + i * 8);
    if (copyFrom == i + 1) {
      continue;
    }
    SymbolMapReader tmp;
    if (copyFrom > 0) {
      tmp=copyOrRenewSymbolMapReader(symbolMapReaders.getAndSetQuick(copyFrom - 1,null),i);
      int copyTo=Unsafe.getUnsafe().getInt(index + i * 8 + 4);
      while (copyTo > 0) {
        if (Unsafe.getUnsafe().getByte(stateAddress + copyTo - 1) == -1) {
          break;
        }
        Unsafe.getUnsafe().putByte(stateAddress + copyTo - 1,(byte)-1);
        tmp=copyOrRenewSymbolMapReader(tmp,copyTo - 1);
        copyTo=Unsafe.getUnsafe().getInt(index + (copyTo - 1) * 8 + 4);
      }
      Misc.free(tmp);
    }
 else {
      Misc.free(symbolMapReaders.getAndSetQuick(i,newSymbolMapReaderInstance(i)));
    }
  }
  if (columnCount < this.columnCount) {
    for (int i=columnCount; i < this.columnCount; i++) {
      Misc.free(symbolMapReaders.getQuick(i));
    }
    symbolMapReaders.setPos(columnCount);
  }
}

Fixed version (ground truth):
public void applyTransitionIndexToSymbolMapReaders(long pTransitionIndex){
  final int columnCount=Unsafe.getUnsafe().getInt(pTransitionIndex + 4);
  final long index=pTransitionIndex + 8;
  final long stateAddress=index + columnCount * 8;
  if (columnCount > this.columnCount) {
    symbolMapReaders.setPos(columnCount);
  }
  Unsafe.getUnsafe().setMemory(stateAddress,columnCount,(byte)0);
  for (int i=0; i < columnCount; i++) {
    if (Unsafe.getUnsafe().getByte(stateAddress + i) == -1) {
      continue;
    }
    Unsafe.getUnsafe().putByte(stateAddress + i,(byte)-1);
    int copyFrom=Unsafe.getUnsafe().getInt(index + i * 8);
    if (copyFrom == i + 1) {
      SymbolMapReader reader=symbolMapReaders.getQuick(copyFrom);
      if (reader != null && reader.isDeleted()) {
        newSymbolMapReaderInstance(copyFrom,reader);
      }
      continue;
    }
    SymbolMapReader tmp;
    if (copyFrom > 0) {
      tmp=copyOrRenewSymbolMapReader(symbolMapReaders.getAndSetQuick(copyFrom - 1,null),i);
      int copyTo=Unsafe.getUnsafe().getInt(index + i * 8 + 4);
      while (copyTo > 0) {
        if (Unsafe.getUnsafe().getByte(stateAddress + copyTo - 1) == -1) {
          break;
        }
        Unsafe.getUnsafe().putByte(stateAddress + copyTo - 1,(byte)-1);
        tmp=copyOrRenewSymbolMapReader(tmp,copyTo - 1);
        copyTo=Unsafe.getUnsafe().getInt(index + (copyTo - 1) * 8 + 4);
      }
      Misc.free(tmp);
    }
 else {
      Misc.free(symbolMapReaders.getAndSetQuick(i,newSymbolMapReaderInstance(i,null)));
    }
  }
  if (columnCount < this.columnCount) {
    for (int i=columnCount; i < this.columnCount; i++) {
      Misc.free(symbolMapReaders.getQuick(i));
    }
    symbolMapReaders.setPos(columnCount);
  }
}