Program: 55815
Project: 55815
Buggy source:
private final void initFields(byte[] data,int begin,int len){
  int pos=begin + len - 2;
  int numFields=data[begin + len - 1];
  if (numFields >= MAX_BIT) {
    int shift=7;
    int curr;
    numFields=numFields & 0x7f;
    while ((curr=data[pos--]) >= MAX_BIT) {
      numFields|=(curr & 0x7f) << shift;
      shift+=7;
    }
    numFields|=curr << shift;
  }
  this.numFields=numFields;
  if (this.offsets == null || this.offsets.length < numFields) {
    this.offsets=new int[numFields];
  }
  if (this.fields == null || this.fields.length < numFields) {
    this.fields=new Value[numFields];
  }
  if (this.lengths == null || this.lengths.length < numFields) {
    this.lengths=new int[numFields];
  }
  final int beginMasks=pos;
  final int fieldsBy8=(numFields >>> 3) + ((numFields & 0x7) == 0 ? 0 : 1);
  pos=beginMasks - fieldsBy8;
  int lastNonNullField=-1;
  for (int field=0, chunk=0; chunk < fieldsBy8; chunk++) {
    int mask=data[beginMasks - chunk];
    for (int i=0; i < 8 && field < numFields; i++, field++) {
      if ((mask & 0x1) == 0x1) {
        if (lastNonNullField >= 0) {
          int start=data[pos--];
          if (start >= MAX_BIT) {
            int shift=7;
            int curr;
            start=start & 0x7f;
            while ((curr=data[pos--]) >= MAX_BIT) {
              start|=(curr & 0x7f) << shift;
              shift+=7;
            }
            start|=curr << shift;
          }
          this.offsets[field]=start + begin;
          this.lengths[lastNonNullField]=start + begin - this.offsets[lastNonNullField];
        }
 else {
          this.offsets[field]=begin;
        }
        lastNonNullField=field;
      }
 else {
        this.offsets[field]=NULL_INDICATOR_OFFSET;
      }
      mask>>=1;
    }
  }
  if (lastNonNullField >= 0) {
    this.lengths[lastNonNullField]=pos - this.offsets[lastNonNullField] + 1;
  }
  this.firstModifiedPos=Integer.MAX_VALUE;
  this.lastUnmodifiedPos=numFields - 1;
}

Fixed version (ground truth):
private final void initFields(byte[] data,int begin,int len){
  int pos=begin + len - 2;
  int numFields=data[begin + len - 1];
  if (numFields >= MAX_BIT) {
    int shift=7;
    int curr;
    numFields=numFields & 0x7f;
    while ((curr=data[pos--]) >= MAX_BIT) {
      numFields|=(curr & 0x7f) << shift;
      shift+=7;
    }
    numFields|=curr << shift;
  }
  this.numFields=numFields;
  if (this.offsets == null || this.offsets.length < numFields) {
    this.offsets=new int[numFields];
  }
  if (this.fields == null || this.fields.length < numFields) {
    this.fields=new Value[numFields];
  }
  if (this.lengths == null || this.lengths.length < numFields) {
    this.lengths=new int[numFields];
  }
  final int beginMasks=pos;
  final int fieldsBy8=(numFields >>> 3) + ((numFields & 0x7) == 0 ? 0 : 1);
  pos=beginMasks - fieldsBy8;
  int lastNonNullField=-1;
  for (int field=0, chunk=0; chunk < fieldsBy8; chunk++) {
    int mask=data[beginMasks - chunk];
    for (int i=0; i < 8 && field < numFields; i++, field++) {
      if ((mask & 0x1) == 0x1) {
        if (lastNonNullField >= 0) {
          int start=data[pos--];
          if (start >= MAX_BIT) {
            int shift=7;
            int curr;
            start=start & 0x7f;
            while ((curr=data[pos--]) >= MAX_BIT) {
              start|=(curr & 0x7f) << shift;
              shift+=7;
            }
            start|=curr << shift;
          }
          this.offsets[field]=start + begin;
          this.lengths[lastNonNullField]=start + begin - this.offsets[lastNonNullField];
        }
 else {
          this.offsets[field]=begin;
        }
        lastNonNullField=field;
      }
 else {
        this.offsets[field]=NULL_INDICATOR_OFFSET;
      }
      mask>>=1;
    }
  }
  if (lastNonNullField >= 0) {
    this.lengths[lastNonNullField]=pos - this.offsets[lastNonNullField] + 1;
  }
  this.firstModifiedPos=Integer.MAX_VALUE;
  this.modified=false;
}