Program: 186431
Project: 186431
Buggy source:
/** 
 * Un-escape a byte sequence as escaped using  {@link #escapeBytes(com.google.protobuf.ByteString)}. Two-digit hex escapes (starting with "\x") are also recognized.
 */
static ByteString unescapeBytes(CharSequence input) throws InvalidEscapeSequence {
  byte[] result=new byte[input.length()];
  int pos=0;
  for (int i=0; i < input.length(); i++) {
    char c=input.charAt(i);
    if (c == '\\') {
      if (i + 1 < input.length()) {
        ++i;
        c=input.charAt(i);
        if (isOctal(c)) {
          int code=digitValue(c);
          if ((i + 1 < input.length()) && isOctal(input.charAt(i + 1))) {
            ++i;
            code=code * 8 + digitValue(input.charAt(i));
          }
          if ((i + 1 < input.length()) && isOctal(input.charAt(i + 1))) {
            ++i;
            code=code * 8 + digitValue(input.charAt(i));
          }
          result[pos++]=(byte)code;
        }
 else {
switch (c) {
case 'a':
            result[pos++]=0x07;
          break;
case 'b':
        result[pos++]='\b';
      break;
case 'f':
    result[pos++]='\f';
  break;
case 'n':
result[pos++]='\n';
break;
case 'r':
result[pos++]='\r';
break;
case 't':
result[pos++]='\t';
break;
case 'v':
result[pos++]=0x0b;
break;
case '\\':
result[pos++]='\\';
break;
case '\'':
result[pos++]='\'';
break;
case '"':
result[pos++]='\"';
break;
case 'x':
int code=0;
if ((i + 1 < input.length()) && isHex(input.charAt(i + 1))) {
++i;
code=digitValue(input.charAt(i));
}
 else {
throw new InvalidEscapeSequence("String_Node_Str");
}
if ((i + 1 < input.length()) && isHex(input.charAt(i + 1))) {
++i;
code=code * 16 + digitValue(input.charAt(i));
}
result[pos++]=(byte)code;
break;
case 'u':
code=(16 * 3 * digitValue(input.charAt(i + 1))) + (16 * 2 * digitValue(input.charAt(i + 2))) + (16 * digitValue(input.charAt(i + 3)))+ digitValue(input.charAt(i + 4));
i=i + 4;
try {
byte[] bytes=String.valueOf((char)code).getBytes("String_Node_Str");
result[pos++]=bytes[0];
result[pos++]=bytes[1];
}
 catch (UnsupportedEncodingException e) {
throw new InvalidEscapeSequence(e.getMessage());
}
break;
default :
throw new InvalidEscapeSequence("String_Node_Str" + c + "String_Node_Str");
}
}
}
 else {
throw new InvalidEscapeSequence("String_Node_Str");
}
}
 else {
result[pos++]=(byte)c;
}
}
return ByteString.copyFrom(result,0,pos);
}

Fixed version (ground truth):
/** 
 * Un-escape a byte sequence as escaped using  {@link #escapeBytes(com.google.protobuf.ByteString)}. Two-digit hex escapes (starting with "\x") are also recognized.
 */
static ByteString unescapeBytes(CharSequence input) throws InvalidEscapeSequence {
  byte[] result=new byte[input.length()];
  int pos=0;
  for (int i=0; i < input.length(); i++) {
    char c=input.charAt(i);
    if (c == '\\') {
      if (i + 1 < input.length()) {
        ++i;
        c=input.charAt(i);
        if (isOctal(c)) {
          int code=digitValue(c);
          if ((i + 1 < input.length()) && isOctal(input.charAt(i + 1))) {
            ++i;
            code=code * 8 + digitValue(input.charAt(i));
          }
          if ((i + 1 < input.length()) && isOctal(input.charAt(i + 1))) {
            ++i;
            code=code * 8 + digitValue(input.charAt(i));
          }
          result[pos++]=(byte)code;
        }
 else {
switch (c) {
case 'a':
            result[pos++]=0x07;
          break;
case 'b':
        result[pos++]='\b';
      break;
case 'f':
    result[pos++]='\f';
  break;
case 'n':
result[pos++]='\n';
break;
case 'r':
result[pos++]='\r';
break;
case 't':
result[pos++]='\t';
break;
case 'v':
result[pos++]=0x0b;
break;
case '\\':
result[pos++]='\\';
break;
case '\'':
result[pos++]='\'';
break;
case '"':
result[pos++]='\"';
break;
case 'x':
int code=0;
if ((i + 1 < input.length()) && isHex(input.charAt(i + 1))) {
++i;
code=digitValue(input.charAt(i));
}
 else {
throw new InvalidEscapeSequence("String_Node_Str");
}
if ((i + 1 < input.length()) && isHex(input.charAt(i + 1))) {
++i;
code=code * 16 + digitValue(input.charAt(i));
}
result[pos++]=(byte)code;
break;
case 'u':
code=(16 * 3 * digitValue(input.charAt(i + 1))) + (16 * 2 * digitValue(input.charAt(i + 2))) + (16 * digitValue(input.charAt(i + 3)))+ digitValue(input.charAt(i + 4));
i=i + 4;
result[pos++]=(byte)code;
break;
default :
throw new InvalidEscapeSequence("String_Node_Str" + c + "String_Node_Str");
}
}
}
 else {
throw new InvalidEscapeSequence("String_Node_Str");
}
}
 else {
result[pos++]=(byte)c;
}
}
return ByteString.copyFrom(result,0,pos);
}