Program: 22928
Project: 22928
Buggy source:
private ParseResult parseWithResult(int aLevel,byte[] aBuf,int aOffset,int aLen){
  String levelPadding=createLevelPadding(aLevel);
  if (aOffset + aLen > aBuf.length) {
    throw new IllegalStateException("String_Node_Str" + aOffset + "String_Node_Str"+ aLen+ "String_Node_Str"+ aBuf.length+ "String_Node_Str"+ aLevel+ "String_Node_Str");
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str",levelPadding,aLevel,aOffset,aLen,HexUtil.toFormattedHexString(aBuf,aOffset,aLen));
  }
  int tagOffset=getTagOffset(aBuf,aOffset);
  BerTag tag=findTag(levelPadding,aBuf,aOffset,tagOffset);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str",levelPadding,tag,tagOffset,HexUtil.toHexString(aBuf,aOffset,tagOffset));
  }
  int dataOffset=getDataOffset(aBuf,aOffset + tagOffset);
  int valueLength=getDataLength(aBuf,aOffset + tagOffset);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str",levelPadding,valueLength,HexUtil.toHexString(aBuf,aOffset + tagOffset,dataOffset));
  }
  if (tag.isConstructed()) {
    ArrayList<BerTlv> list=new ArrayList<BerTlv>();
    addChildren(aLevel,aBuf,aOffset,levelPadding,tagOffset,dataOffset,valueLength,list);
    int resultOffset=aOffset + tagOffset + dataOffset+ valueLength;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",levelPadding,resultOffset);
    }
    return new ParseResult(new BerTlv(tag,list),resultOffset);
  }
 else {
    byte[] value=new byte[valueLength];
    System.arraycopy(aBuf,aOffset + tagOffset + dataOffset,value,0,valueLength);
    int resultOffset=aOffset + tagOffset + dataOffset+ valueLength;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",levelPadding,HexUtil.toFormattedHexString(value));
      log.debug("String_Node_Str",levelPadding,resultOffset);
    }
    return new ParseResult(new BerTlv(tag,value),resultOffset);
  }
}

Fixed version (ground truth):
private ParseResult parseWithResult(int aLevel,byte[] aBuf,int aOffset,int aLen){
  String levelPadding=createLevelPadding(aLevel);
  if (aOffset + aLen > aBuf.length) {
    throw new IllegalStateException("String_Node_Str" + aOffset + "String_Node_Str"+ aLen+ "String_Node_Str"+ aBuf.length+ "String_Node_Str"+ aLevel+ "String_Node_Str");
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str",levelPadding,aLevel,aOffset,aLen,HexUtil.toFormattedHexString(aBuf,aOffset,aLen));
  }
  int tagBytesCount=getTagBytesCount(aBuf,aOffset);
  BerTag tag=createTag(levelPadding,aBuf,aOffset,tagBytesCount);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str",levelPadding,tag,tagBytesCount,HexUtil.toFormattedHexString(aBuf,aOffset,tagBytesCount));
  }
  int lengthBytesCount=getLengthBytesCount(aBuf,aOffset + tagBytesCount);
  int valueLength=getDataLength(aBuf,aOffset + tagBytesCount);
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str",levelPadding,lengthBytesCount,valueLength,HexUtil.toFormattedHexString(aBuf,aOffset + tagBytesCount,lengthBytesCount));
  }
  if (tag.isConstructed()) {
    ArrayList<BerTlv> list=new ArrayList<BerTlv>();
    addChildren(aLevel,aBuf,aOffset,levelPadding,tagBytesCount,lengthBytesCount,valueLength,list);
    int resultOffset=aOffset + tagBytesCount + lengthBytesCount+ valueLength;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",levelPadding,resultOffset);
    }
    return new ParseResult(new BerTlv(tag,list),resultOffset);
  }
 else {
    byte[] value=new byte[valueLength];
    System.arraycopy(aBuf,aOffset + tagBytesCount + lengthBytesCount,value,0,valueLength);
    int resultOffset=aOffset + tagBytesCount + lengthBytesCount+ valueLength;
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",levelPadding,HexUtil.toFormattedHexString(value));
      log.debug("String_Node_Str",levelPadding,resultOffset);
    }
    return new ParseResult(new BerTlv(tag,value),resultOffset);
  }
}