Program: 30940
Project: 30940
Buggy source:
public void parse(long lo,long len,JsonListener listener) throws JsonException {
  long p=lo;
  long hi=lo + len;
  long valueStart=0;
  boolean quoted=false;
  boolean ignoreNext=false;
  while (p < hi) {
    char c=(char)Unsafe.getUnsafe().getByte(p++);
    if (ignoreNext) {
      ignoreNext=false;
      continue;
    }
    if (valueStart > 0 && ((quoted && c != '"') || (!quoted && (c == '-' || c == '.' || c == 'e' || c == 'E' || (c >= '0' && c <= '9'))))) {
      if (quoted && c == '\\') {
        ignoreNext=true;
      }
      continue;
    }
    if (valueStart > 0) {
      if (state == S_EXPECT_NAME || state == S_EXPECT_FIRST_NAME) {
        listener.onEvent(EVT_NAME,dbcs.of(valueStart,p - 1));
        state=S_EXPECT_COLON;
      }
 else {
        listener.onEvent(arrayDepth > 0 ? EVT_ARRAY_VALUE : EVT_VALUE,dbcs.of(valueStart,p - 1));
        state=S_EXPECT_COMMA;
      }
      valueStart=0;
      if (quoted) {
        continue;
      }
    }
switch (c) {
case '{':
      if (state != S_START && state != S_EXPECT_VALUE) {
        throw JsonException.with("String_Node_Str",(int)(p - lo));
      }
    arrayDepthStack.push(arrayDepth);
  arrayDepth=0;
listener.onEvent(EVT_OBJ_START,null);
objDepth++;
state=S_EXPECT_FIRST_NAME;
break;
case '}':
if (arrayDepth > 0) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
if (objDepth > 0) {
switch (state) {
case S_EXPECT_VALUE:
throw JsonException.with("String_Node_Str",(int)(p - lo - 1));
case S_EXPECT_NAME:
throw JsonException.with("String_Node_Str",(int)(p - lo - 1));
default :
break;
}
listener.onEvent(EVT_OBJ_END,null);
objDepth--;
arrayDepth=arrayDepthStack.pop();
state=S_EXPECT_COMMA;
}
 else {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
break;
case '[':
if (state != S_START && state != S_EXPECT_VALUE) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
listener.onEvent(EVT_ARRAY_START,null);
objDepthStack.push(objDepth);
objDepth=0;
arrayDepth++;
state=S_EXPECT_VALUE;
break;
case ']':
if (objDepth > 0) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
if (arrayDepth == 0) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
listener.onEvent(EVT_ARRAY_END,null);
arrayDepth--;
objDepth=objDepthStack.pop();
state=S_EXPECT_COMMA;
break;
case ' ':
case '\t':
case '\n':
case '\r':
break;
case ',':
if (state != S_EXPECT_COMMA) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
if (arrayDepth > 0) {
state=S_EXPECT_VALUE;
}
 else {
state=S_EXPECT_NAME;
}
break;
case ':':
if (state != S_EXPECT_COLON) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
state=S_EXPECT_VALUE;
break;
case '"':
if (state != S_EXPECT_NAME && state != S_EXPECT_FIRST_NAME && state != S_EXPECT_VALUE) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
valueStart=p;
quoted=true;
break;
default :
if (state != S_EXPECT_VALUE) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
valueStart=p - 1;
quoted=false;
}
}
}

Fixed version (ground truth):
public void parse(long lo,long len,JsonListener listener) throws JsonException {
  long p=lo;
  long hi=lo + len;
  long valueStart=useCache ? lo : 0;
  while (p < hi) {
    char c=(char)Unsafe.getUnsafe().getByte(p++);
    if (ignoreNext) {
      ignoreNext=false;
      continue;
    }
    if (valueStart > 0 && ((quoted && c != '"') || (!quoted && !unquotedTeminators.contains(c)))) {
      if (quoted && c == '\\') {
        ignoreNext=true;
      }
      continue;
    }
    if (valueStart > 0) {
      if (state == S_EXPECT_NAME || state == S_EXPECT_FIRST_NAME) {
        listener.onEvent(EVT_NAME,getCharSequence(valueStart,p));
        state=S_EXPECT_COLON;
      }
 else {
        listener.onEvent(arrayDepth > 0 ? EVT_ARRAY_VALUE : EVT_VALUE,getCharSequence(valueStart,p));
        state=S_EXPECT_COMMA;
      }
      valueStart=0;
      cacheSize=0;
      useCache=false;
      if (quoted) {
        continue;
      }
    }
switch (c) {
case '{':
      if (state != S_START && state != S_EXPECT_VALUE) {
        throw JsonException.with("String_Node_Str",(int)(p - lo));
      }
    arrayDepthStack.push(arrayDepth);
  arrayDepth=0;
listener.onEvent(EVT_OBJ_START,null);
objDepth++;
state=S_EXPECT_FIRST_NAME;
break;
case '}':
if (arrayDepth > 0) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
if (objDepth > 0) {
switch (state) {
case S_EXPECT_VALUE:
throw JsonException.with("String_Node_Str",(int)(p - lo - 1));
case S_EXPECT_NAME:
throw JsonException.with("String_Node_Str",(int)(p - lo - 1));
default :
break;
}
listener.onEvent(EVT_OBJ_END,null);
objDepth--;
arrayDepth=arrayDepthStack.pop();
state=S_EXPECT_COMMA;
}
 else {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
break;
case '[':
if (state != S_START && state != S_EXPECT_VALUE) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
listener.onEvent(EVT_ARRAY_START,null);
objDepthStack.push(objDepth);
objDepth=0;
arrayDepth++;
state=S_EXPECT_VALUE;
break;
case ']':
if (objDepth > 0) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
if (arrayDepth == 0) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
listener.onEvent(EVT_ARRAY_END,null);
arrayDepth--;
objDepth=objDepthStack.pop();
state=S_EXPECT_COMMA;
break;
case ' ':
case '\t':
case '\n':
case '\r':
break;
case ',':
if (state != S_EXPECT_COMMA) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
if (arrayDepth > 0) {
state=S_EXPECT_VALUE;
}
 else {
state=S_EXPECT_NAME;
}
break;
case ':':
if (state != S_EXPECT_COLON) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
state=S_EXPECT_VALUE;
break;
case '"':
if (state != S_EXPECT_NAME && state != S_EXPECT_FIRST_NAME && state != S_EXPECT_VALUE) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
valueStart=p;
quoted=true;
break;
default :
if (state != S_EXPECT_VALUE) {
throw JsonException.with("String_Node_Str",(int)(p - lo));
}
valueStart=p - 1;
quoted=false;
}
}
if (valueStart > 0) {
cacheIncompleteTag(valueStart,lo,hi);
useCache=true;
}
}