Program: 88000
Project: 88000
Buggy source:
/** 
 * Updates the binary representation of the data, such that it reflects the state of the currently stored fields. If the binary representation is already up to date, nothing happens. Otherwise, this function triggers the modified fields to serialize themselves into the records buffer and afterwards updates the offset table.
 */
public void updateBinaryRepresenation(){
  final int firstModified=this.firstModifiedPos;
  final int numFields=this.numFields;
  if (firstModified >= numFields) {
    return;
  }
  final int[] offsets=this.offsets;
  if (this.serializer == null) {
    this.serializer=new InternalDeSerializer();
  }
  final InternalDeSerializer serializer=this.serializer;
  int offset=firstModified <= 0 ? 0 : this.offsets[firstModified - 1] + this.lengths[firstModified - 1];
  serializer.position=offset;
  if (this.lastUnmodifiedPos < firstModified) {
    serializer.memory=this.binaryData == null ? new byte[numFields * DEFAULT_FIELD_LEN] : this.binaryData;
    try {
      for (int i=firstModified; i < numFields; i++) {
        if (offsets[i] == NULL_INDICATOR_OFFSET)         continue;
        offsets[i]=offset;
        this.fields[i].write(serializer);
        int newOffset=serializer.position;
        this.lengths[i]=newOffset - offset;
        offset=newOffset;
      }
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.getMessage());
    }
  }
 else {
    serializer.memory=this.serializationSwitchBuffer == null ? new byte[numFields * DEFAULT_FIELD_LEN] : this.serializationSwitchBuffer;
    if (offset > 0 & this.binaryData != null) {
      System.arraycopy(this.binaryData,0,serializer.memory,0,offset);
    }
    try {
      for (int i=firstModified; i < numFields; i++) {
        final int co=offsets[i];
        if (co == NULL_INDICATOR_OFFSET)         continue;
        offsets[i]=offset;
        if (co == MODIFIED_INDICATOR_OFFSET)         this.fields[i].write(serializer);
 else         serializer.write(this.binaryData,co,this.lengths[i]);
        this.lengths[i]=serializer.position - offset;
        offset=serializer.position;
      }
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str" + e.getMessage());
    }
    this.serializationSwitchBuffer=this.binaryData;
    this.binaryData=serializer.memory;
  }
  try {
    if (numFields <= 8) {
      int mask=0;
      for (int i=numFields - 1; i > 0; i--) {
        mask<<=1;
        if (offsets[i] != NULL_INDICATOR_OFFSET) {
          serializer.writeValLenIntBackwards(offsets[i]);
          mask|=0x1;
        }
      }
      mask<<=1;
      mask|=(offsets[0] != NULL_INDICATOR_OFFSET) ? 0x1 : 0x0;
      serializer.writeByte(mask);
    }
 else {
      for (int i=numFields - 1; i > 0; i--) {
        if (offsets[i] != NULL_INDICATOR_OFFSET) {
          serializer.writeValLenIntBackwards(offsets[i]);
        }
      }
      int col=numFields - 1;
      int mask=0;
      for (int i=numFields & 0x7; i >= 0; i--, col--) {
        mask<<=1;
        mask|=(offsets[col] != NULL_INDICATOR_OFFSET) ? 0x1 : 0x0;
      }
      serializer.writeByte(mask);
      for (int i=numFields >>> 3; i >= 0; i--) {
        mask=0;
        for (int k=0; k < 8; k++, col--) {
          mask<<=1;
          mask|=(offsets[col] != NULL_INDICATOR_OFFSET) ? 0x1 : 0x0;
        }
        serializer.writeByte(mask);
      }
    }
    serializer.writeValLenIntBackwards(numFields);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + e.getMessage(),e);
  }
  this.binaryData=serializer.memory;
  this.binaryLen=serializer.position;
  this.firstModifiedPos=Integer.MAX_VALUE;
  this.lastUnmodifiedPos=numFields - 1;
}

Fixed version (ground truth):
/** 
 * Updates the binary representation of the data, such that it reflects the state of the currently stored fields. If the binary representation is already up to date, nothing happens. Otherwise, this function triggers the modified fields to serialize themselves into the records buffer and afterwards updates the offset table.
 */
public void updateBinaryRepresenation(){
  if (!this.modified)   return;
  final int firstModified=this.firstModifiedPos;
  final int numFields=this.numFields;
  final int[] offsets=this.offsets;
  if (this.serializer == null) {
    this.serializer=new InternalDeSerializer();
  }
  final InternalDeSerializer serializer=this.serializer;
  if (numFields > 0) {
    int offset=firstModified <= 0 ? 0 : this.offsets[firstModified - 1] + this.lengths[firstModified - 1];
    serializer.position=offset;
    if (firstModified > 0) {
      serializer.memory=this.binaryData == null ? new byte[numFields * DEFAULT_FIELD_LEN] : this.binaryData;
      try {
        for (int i=firstModified; i < numFields; i++) {
          if (offsets[i] == NULL_INDICATOR_OFFSET)           continue;
          offsets[i]=offset;
          this.fields[i].write(serializer);
          int newOffset=serializer.position;
          this.lengths[i]=newOffset - offset;
          offset=newOffset;
        }
      }
 catch (      Exception e) {
        throw new RuntimeException("String_Node_Str" + e.getMessage());
      }
    }
 else {
      serializer.memory=this.serializationSwitchBuffer == null ? new byte[numFields * DEFAULT_FIELD_LEN] : this.serializationSwitchBuffer;
      if (offset > 0 & this.binaryData != null) {
        System.arraycopy(this.binaryData,0,serializer.memory,0,offset);
      }
      try {
        for (int i=firstModified; i < numFields; i++) {
          final int co=offsets[i];
          if (co == NULL_INDICATOR_OFFSET)           continue;
          offsets[i]=offset;
          if (co == MODIFIED_INDICATOR_OFFSET)           this.fields[i].write(serializer);
 else           serializer.write(this.binaryData,co,this.lengths[i]);
          this.lengths[i]=serializer.position - offset;
          offset=serializer.position;
        }
      }
 catch (      Exception e) {
        throw new RuntimeException("String_Node_Str" + e.getMessage());
      }
      this.serializationSwitchBuffer=this.binaryData;
      this.binaryData=serializer.memory;
    }
  }
  try {
    if (numFields <= 8) {
      int mask=0;
      for (int i=numFields - 1; i > 0; i--) {
        mask<<=1;
        if (offsets[i] != NULL_INDICATOR_OFFSET) {
          serializer.writeValLenIntBackwards(offsets[i]);
          mask|=0x1;
        }
      }
      mask<<=1;
      mask|=(offsets[0] != NULL_INDICATOR_OFFSET) ? 0x1 : 0x0;
      serializer.writeByte(mask);
    }
 else {
      for (int i=numFields - 1; i > 0; i--) {
        if (offsets[i] != NULL_INDICATOR_OFFSET) {
          serializer.writeValLenIntBackwards(offsets[i]);
        }
      }
      int col=numFields - 1;
      int mask=0;
      for (int i=numFields & 0x7; i >= 0; i--, col--) {
        mask<<=1;
        mask|=(offsets[col] != NULL_INDICATOR_OFFSET) ? 0x1 : 0x0;
      }
      serializer.writeByte(mask);
      for (int i=numFields >>> 3; i >= 0; i--) {
        mask=0;
        for (int k=0; k < 8; k++, col--) {
          mask<<=1;
          mask|=(offsets[col] != NULL_INDICATOR_OFFSET) ? 0x1 : 0x0;
        }
        serializer.writeByte(mask);
      }
    }
    serializer.writeValLenIntBackwards(numFields);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + e.getMessage(),e);
  }
  this.binaryData=serializer.memory;
  this.binaryLen=serializer.position;
  this.firstModifiedPos=Integer.MAX_VALUE;
  this.modified=false;
}