Program: 15763
Project: 15763
Buggy source:
/** 
 * Read an inner node page from the buffer, but ignore the keys and values.
 * @param fileStore the file store
 * @param filePos the position in the file
 * @param mapId the map id
 * @param pos the position
 * @return the page children object
 */
static PageChildren read(FileStore fileStore,long filePos,int mapId,long pos){
  ByteBuffer buff;
  int maxLength=DataUtils.getPageMaxLength(pos);
  if (maxLength == DataUtils.PAGE_LARGE) {
    buff=fileStore.readFully(filePos,128);
    maxLength=buff.getInt();
  }
  long fileSize=fileStore.fileSize;
  maxLength=(int)Math.min(fileSize - filePos,maxLength);
  int length=maxLength;
  if (length < 0) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",length,filePos,fileSize);
  }
  buff=fileStore.readFully(filePos,length);
  int chunkId=DataUtils.getPageChunkId(pos);
  int offset=DataUtils.getPageOffset(pos);
  int start=buff.position();
  int pageLength=buff.getInt();
  if (pageLength > maxLength) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",chunkId,maxLength,pageLength);
  }
  buff.limit(start + pageLength);
  short check=buff.getShort();
  int m=DataUtils.readVarInt(buff);
  if (m != mapId) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",chunkId,mapId,m);
  }
  int checkTest=DataUtils.getCheckValue(chunkId) ^ DataUtils.getCheckValue(offset) ^ DataUtils.getCheckValue(pageLength);
  if (check != (short)checkTest) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",chunkId,checkTest,check);
  }
  int len=DataUtils.readVarInt(buff);
  int type=buff.get();
  boolean node=(type & 1) == DataUtils.PAGE_TYPE_NODE;
  if (!node) {
    return null;
  }
  long[] children=new long[len + 1];
  for (int i=0; i <= len; i++) {
    children[i]=buff.getLong();
  }
  return new PageChildren(pos,children);
}

Fixed version (ground truth):
/** 
 * Read an inner node page from the buffer, but ignore the keys and values.
 * @param fileStore the file store
 * @param pos the position
 * @param mapId the map id
 * @param filePos the position in the file
 * @param maxPos the maximum position (the end of the chunk)
 * @return the page children object
 */
static PageChildren read(FileStore fileStore,long pos,int mapId,long filePos,long maxPos){
  ByteBuffer buff;
  int maxLength=DataUtils.getPageMaxLength(pos);
  if (maxLength == DataUtils.PAGE_LARGE) {
    buff=fileStore.readFully(filePos,128);
    maxLength=buff.getInt();
  }
  maxLength=(int)Math.min(maxPos - filePos,maxLength);
  int length=maxLength;
  if (length < 0) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",length,filePos,maxPos);
  }
  buff=fileStore.readFully(filePos,length);
  int chunkId=DataUtils.getPageChunkId(pos);
  int offset=DataUtils.getPageOffset(pos);
  int start=buff.position();
  int pageLength=buff.getInt();
  if (pageLength > maxLength) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",chunkId,maxLength,pageLength);
  }
  buff.limit(start + pageLength);
  short check=buff.getShort();
  int m=DataUtils.readVarInt(buff);
  if (m != mapId) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",chunkId,mapId,m);
  }
  int checkTest=DataUtils.getCheckValue(chunkId) ^ DataUtils.getCheckValue(offset) ^ DataUtils.getCheckValue(pageLength);
  if (check != (short)checkTest) {
    throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"String_Node_Str",chunkId,checkTest,check);
  }
  int len=DataUtils.readVarInt(buff);
  int type=buff.get();
  boolean node=(type & 1) == DataUtils.PAGE_TYPE_NODE;
  if (!node) {
    return null;
  }
  long[] children=new long[len + 1];
  for (int i=0; i <= len; i++) {
    children[i]=buff.getLong();
  }
  return new PageChildren(pos,children);
}