Program: 44927
Project: 44927
Buggy source:
public FileHeader(BlockHeader bh,byte[] fileHeader){
  super(bh);
  int position=0;
  unpSize=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  hostOS=HostSystem.findHostSystem(fileHeader[4]);
  position++;
  fileCRC=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  fileTime=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  unpVersion|=fileHeader[13] & 0xff;
  position++;
  unpMethod|=fileHeader[14] & 0xff;
  position++;
  nameSize=Raw.readShortLittleEndian(fileHeader,position);
  position+=2;
  fileAttr=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  if (isLargeBlock()) {
    highPackSize=Raw.readIntLittleEndian(fileHeader,position);
    position+=4;
    highUnpackSize=Raw.readIntLittleEndian(fileHeader,position);
    position+=4;
  }
 else {
    highPackSize=0;
    highUnpackSize=0;
    if (unpSize == 0xffffffff) {
      unpSize=0xffffffff;
      highUnpackSize=Integer.MAX_VALUE;
    }
  }
  fullPackSize|=highPackSize;
  fullPackSize<<=32;
  fullPackSize|=getPackSize();
  fullUnpackSize|=highUnpackSize;
  fullUnpackSize<<=32;
  fullUnpackSize|=unpSize;
  nameSize=nameSize > 4 * 1024 ? 4 * 1024 : nameSize;
  fileName=new byte[nameSize];
  for (int i=0; i < nameSize; i++) {
    fileName[i]=fileHeader[position];
    position++;
  }
  if (isFileHeader()) {
    if (isUnicode()) {
      int length=strlen(fileName);
      if (length == nameSize) {
      }
 else {
        byte[] buff1=new byte[length];
        int j=0;
        for (; j < length; j++)         buff1[j]=fileName[j];
        ++length;
        byte[] buff2=new byte[nameSize - length];
        int k=0;
        for (j=length; j < nameSize; k++, j++)         buff2[k]=fileName[j];
        fileNameW=FileNameDecoder.decode(new String(buff1),buff2);
      }
    }
 else {
      fileNameW=new String(fileName);
    }
  }
  if (UnrarHeadertype.NewSubHeader.equals(headerType)) {
    int datasize=headerSize - NEWLHD_SIZE - nameSize;
    if (hasSalt()) {
      datasize-=SALT_SIZE;
    }
    if (datasize > 0) {
      subData=new byte[datasize];
      for (int i=0; i < datasize; i++) {
        subData[i]=(fileHeader[position]);
        position++;
      }
    }
    if (NewSubHeaderType.SUBHEAD_TYPE_RR.byteEquals(fileName)) {
      recoverySectors=subData[8] + (subData[9] << 8) + (subData[10] << 16)+ (subData[11] << 24);
    }
  }
  if (hasSalt()) {
    for (int i=0; i < SALT_SIZE; i++) {
      salt[i]=fileHeader[position];
      position++;
    }
  }
  mTime=getDateDos(fileTime);
}

Fixed version (ground truth):
public FileHeader(BlockHeader bh,byte[] fileHeader){
  super(bh);
  int position=0;
  unpSize=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  hostOS=HostSystem.findHostSystem(fileHeader[4]);
  position++;
  fileCRC=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  fileTime=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  unpVersion|=fileHeader[13] & 0xff;
  position++;
  unpMethod|=fileHeader[14] & 0xff;
  position++;
  nameSize=Raw.readShortLittleEndian(fileHeader,position);
  position+=2;
  fileAttr=Raw.readIntLittleEndian(fileHeader,position);
  position+=4;
  if (isLargeBlock()) {
    highPackSize=Raw.readIntLittleEndian(fileHeader,position);
    position+=4;
    highUnpackSize=Raw.readIntLittleEndian(fileHeader,position);
    position+=4;
  }
 else {
    highPackSize=0;
    highUnpackSize=0;
    if (unpSize == 0xffffffff) {
      unpSize=0xffffffff;
      highUnpackSize=Integer.MAX_VALUE;
    }
  }
  fullPackSize|=highPackSize;
  fullPackSize<<=32;
  fullPackSize|=getPackSize();
  fullUnpackSize|=highUnpackSize;
  fullUnpackSize<<=32;
  fullUnpackSize|=unpSize;
  nameSize=nameSize > 4 * 1024 ? 4 * 1024 : nameSize;
  fileName=new byte[nameSize];
  for (int i=0; i < nameSize; i++) {
    fileName[i]=fileHeader[position];
    position++;
  }
  if (isFileHeader()) {
    if (isUnicode()) {
      int length=0;
      fileNameW="String_Node_Str";
      while (length < fileName.length && fileName[length] != 0) {
        length++;
      }
      byte[] name=new byte[length];
      System.arraycopy(fileName,0,name,0,name.length);
      if (length != nameSize) {
        length++;
        fileNameW=FileNameDecoder.decode(fileName,length);
      }
 else       fileNameW=new String(name);
    }
 else {
      fileNameW=new String(fileName);
    }
  }
  if (UnrarHeadertype.NewSubHeader.equals(headerType)) {
    int datasize=headerSize - NEWLHD_SIZE - nameSize;
    if (hasSalt()) {
      datasize-=SALT_SIZE;
    }
    if (datasize > 0) {
      subData=new byte[datasize];
      for (int i=0; i < datasize; i++) {
        subData[i]=(fileHeader[position]);
        position++;
      }
    }
    if (NewSubHeaderType.SUBHEAD_TYPE_RR.byteEquals(fileName)) {
      recoverySectors=subData[8] + (subData[9] << 8) + (subData[10] << 16)+ (subData[11] << 24);
    }
  }
  if (hasSalt()) {
    for (int i=0; i < SALT_SIZE; i++) {
      salt[i]=fileHeader[position];
      position++;
    }
  }
  mTime=getDateDos(fileTime);
}