Program: 100516
Project: 100516
Buggy source:
/** 
 * @return the value of the Utf8 string at constant pool item i
 */
public String getCPUtf8(int i) throws InvalidClassFileException {
  if (i < 1 || i >= cpItems.length) {
    throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str");
  }
  int offset=cpOffsets[i];
  if (offset == 0 || getByte(offset) != CONSTANT_Utf8) {
    throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str");
  }
  String s=cpItems[i];
  if (s == null) {
    int count=getUShort(offset + 1);
    int end=count + offset + 3;
    StringBuffer buf=new StringBuffer(count);
    offset+=3;
    while (offset < end) {
      byte x=getByte(offset);
      if ((x & 0x80) == 0) {
        if (x == 0) {
          throw invalidUtf8(i,offset);
        }
        buf.append((char)x);
        offset++;
      }
 else       if ((x & 0xE0) == 0xC0) {
        if (offset + 1 >= end) {
          throw invalidUtf8(i,offset);
        }
        byte y=getByte(offset + 1);
        if ((y & 0xC0) != 0x80) {
          throw invalidUtf8(i,offset);
        }
        buf.append((char)(((x & 0x1F) << 6) + (y & 0x3F)));
        offset+=2;
      }
 else       if ((x & 0xF0) == 0xE0) {
        if (offset + 2 >= end) {
          throw invalidUtf8(i,offset);
        }
        byte y=getByte(offset + 1);
        byte z=getByte(offset + 2);
        if ((y & 0xC0) != 0x80 || (z & 0xC0) != 0x80) {
          throw invalidUtf8(i,offset);
        }
        buf.append((char)(((x & 0x0F) << 12) + ((y & 0x3F) << 6) + (z & 0x3F)));
        offset+=3;
      }
 else {
        throw invalidUtf8(i,offset);
      }
    }
    s=buf.toString().intern();
    cpItems[i]=s;
  }
  return s;
}

Fixed version (ground truth):
/** 
 * @return the value of the Utf8 string at constant pool item i
 */
public String getCPUtf8(int i) throws InvalidClassFileException, IllegalArgumentException {
  if (i < 1 || i >= cpItems.length) {
    throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str");
  }
  int offset=cpOffsets[i];
  if (offset == 0 || getByte(offset) != CONSTANT_Utf8) {
    throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str");
  }
  String s=cpItems[i];
  if (s == null) {
    int count=getUShort(offset + 1);
    int end=count + offset + 3;
    StringBuffer buf=new StringBuffer(count);
    offset+=3;
    while (offset < end) {
      byte x=getByte(offset);
      if ((x & 0x80) == 0) {
        if (x == 0) {
          throw invalidUtf8(i,offset);
        }
        buf.append((char)x);
        offset++;
      }
 else       if ((x & 0xE0) == 0xC0) {
        if (offset + 1 >= end) {
          throw invalidUtf8(i,offset);
        }
        byte y=getByte(offset + 1);
        if ((y & 0xC0) != 0x80) {
          throw invalidUtf8(i,offset);
        }
        buf.append((char)(((x & 0x1F) << 6) + (y & 0x3F)));
        offset+=2;
      }
 else       if ((x & 0xF0) == 0xE0) {
        if (offset + 2 >= end) {
          throw invalidUtf8(i,offset);
        }
        byte y=getByte(offset + 1);
        byte z=getByte(offset + 2);
        if ((y & 0xC0) != 0x80 || (z & 0xC0) != 0x80) {
          throw invalidUtf8(i,offset);
        }
        buf.append((char)(((x & 0x0F) << 12) + ((y & 0x3F) << 6) + (z & 0x3F)));
        offset+=3;
      }
 else {
        throw invalidUtf8(i,offset);
      }
    }
    s=buf.toString().intern();
    cpItems[i]=s;
  }
  return s;
}