Program: 80145
Project: 80145
Buggy source:
/** 
 * Fill the buffer, return true if eof has been reached.
 */
private boolean fillBuffer() throws IOException {
  if (in == null)   return true;
  charactersInBuffer=0;
  try {
    try {
      parent.setupContextStack();
      if (this.positionedIn != null) {
        try {
          this.positionedIn.reposition(this.rawStreamPos);
        }
 catch (        StandardException se) {
          throw Util.generateCsSQLException(se);
        }
      }
      readChars:       while ((charactersInBuffer < buffer.length) && ((utfCount < utfLen) || (utfLen == 0)) && ((maxFieldSize == 0) || (readerCharCount < maxFieldSize))) {
        int c=in.read();
        if (c == -1) {
          if (utfLen == 0) {
            closeIn();
            break readChars;
          }
          throw utfFormatException("String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ utfLen+ "String_Node_Str");
        }
        int finalChar;
switch (c >> 4) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
          utfCount++;
        finalChar=c;
      break;
case 12:
case 13:
{
      utfCount+=2;
      int char2=in.read();
      if (char2 == -1)       throw utfFormatException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ readerCharCount);
      if ((char2 & 0xC0) != 0x80)       throw utfFormatException("String_Node_Str" + "String_Node_Str" + char2 + "String_Node_Str"+ utfCount+ "String_Node_Str"+ readerCharCount);
      finalChar=(((c & 0x1F) << 6) | (char2 & 0x3F));
      break;
    }
case 14:
{
    utfCount+=3;
    int char2=in.read();
    int char3=in.read();
    if (char2 == -1 || char3 == -1)     throw utfFormatException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ readerCharCount);
    if ((c == 0xE0) && (char2 == 0) && (char3 == 0)) {
      if (utfLen == 0) {
        closeIn();
        break readChars;
      }
      throw utfFormatException("String_Node_Str" + "String_Node_Str");
    }
    if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80))     throw utfFormatException("String_Node_Str" + "String_Node_Str" + char2 + "String_Node_Str"+ char3+ "String_Node_Str"+ utfCount+ "String_Node_Str"+ readerCharCount);
    finalChar=(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
  }
break;
default :
throw utfFormatException("String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ readerCharCount+ "String_Node_Str"+ c);
}
buffer[charactersInBuffer++]=(char)finalChar;
readerCharCount++;
}
if (utfLen != 0 && utfCount > utfLen) throw utfFormatException("String_Node_Str" + "String_Node_Str" + utfLen + "String_Node_Str"+ utfCount+ "String_Node_Str");
if (charactersInBuffer != 0) {
if (this.positionedIn != null) {
this.rawStreamPos=this.positionedIn.getPosition();
}
return false;
}
closeIn();
return true;
}
  finally {
parent.restoreContextStack();
}
}
 catch (SQLException sqle) {
IOException ioe=new IOException(sqle.getSQLState() + "String_Node_Str" + sqle.getMessage());
ioe.initCause(sqle);
throw ioe;
}
}

Fixed version (ground truth):
/** 
 * Fills the internal character buffer by decoding bytes from the stream.
 * @return <code>true</code> if the end of the stream is reached,<code>false</code> if there is apparently more data to be read.
 */
private boolean fillBuffer() throws IOException {
  if (in == null)   return true;
  charactersInBuffer=0;
  try {
    try {
      parent.setupContextStack();
      if (this.positionedIn != null) {
        try {
          this.positionedIn.reposition(this.rawStreamPos);
        }
 catch (        StandardException se) {
          throw Util.generateCsSQLException(se);
        }
      }
      readChars:       while ((charactersInBuffer < buffer.length) && ((utfCount < utfLen) || (utfLen == 0)) && ((maxFieldSize == 0) || (readerCharCount < maxFieldSize))) {
        int c=in.read();
        if (c == -1) {
          if (utfLen == 0) {
            closeIn();
            break readChars;
          }
          throw utfFormatException("String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ utfLen+ "String_Node_Str");
        }
        int finalChar;
switch (c >> 4) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
          utfCount++;
        finalChar=c;
      break;
case 12:
case 13:
{
      utfCount+=2;
      int char2=in.read();
      if (char2 == -1)       throw utfFormatException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ readerCharCount);
      if ((char2 & 0xC0) != 0x80)       throw utfFormatException("String_Node_Str" + "String_Node_Str" + char2 + "String_Node_Str"+ utfCount+ "String_Node_Str"+ readerCharCount);
      finalChar=(((c & 0x1F) << 6) | (char2 & 0x3F));
      break;
    }
case 14:
{
    utfCount+=3;
    int char2=in.read();
    int char3=in.read();
    if (char2 == -1 || char3 == -1)     throw utfFormatException("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ readerCharCount);
    if ((c == 0xE0) && (char2 == 0) && (char3 == 0)) {
      if (utfLen == 0) {
        closeIn();
        break readChars;
      }
      throw utfFormatException("String_Node_Str" + "String_Node_Str");
    }
    if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80))     throw utfFormatException("String_Node_Str" + "String_Node_Str" + char2 + "String_Node_Str"+ char3+ "String_Node_Str"+ utfCount+ "String_Node_Str"+ readerCharCount);
    finalChar=(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
  }
break;
default :
throw utfFormatException("String_Node_Str" + "String_Node_Str" + utfCount + "String_Node_Str"+ readerCharCount+ "String_Node_Str"+ c);
}
buffer[charactersInBuffer++]=(char)finalChar;
readerCharCount++;
}
if (utfLen != 0 && utfCount > utfLen) throw utfFormatException("String_Node_Str" + "String_Node_Str" + utfLen + "String_Node_Str"+ utfCount+ "String_Node_Str");
if (charactersInBuffer != 0) {
if (this.positionedIn != null) {
this.rawStreamPos=this.positionedIn.getPosition();
}
return false;
}
closeIn();
return true;
}
  finally {
parent.restoreContextStack();
}
}
 catch (SQLException sqle) {
IOException ioe=new IOException(sqle.getSQLState() + "String_Node_Str" + sqle.getMessage());
ioe.initCause(sqle);
throw ioe;
}
}