mirror of
https://github.com/fangyidong/json-simple.git
synced 2025-12-06 07:20:53 +03:00
Issue #12: Excessive memory consumption in parse() (contributed by glen.tw)
This commit is contained in:
@@ -46,7 +46,7 @@ FALLBACK_CH = .
|
||||
}
|
||||
<STRING_BEGIN> \\ {sb.append('\\');}
|
||||
|
||||
<YYINITIAL> \" { sb.delete(0, sb.length());yybegin(STRING_BEGIN);}
|
||||
<YYINITIAL> \" { sb = null; sb = new StringBuffer(); yybegin(STRING_BEGIN);}
|
||||
<YYINITIAL> {INT} { Long val=Long.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val);}
|
||||
<YYINITIAL> {DOUBLE} { Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val);}
|
||||
<YYINITIAL> "true"|"false" { Boolean val=Boolean.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val);}
|
||||
@@ -58,4 +58,4 @@ FALLBACK_CH = .
|
||||
<YYINITIAL> "," { return new Yytoken(Yytoken.TYPE_COMMA,null);}
|
||||
<YYINITIAL> ":" { return new Yytoken(Yytoken.TYPE_COLON,null);}
|
||||
<YYINITIAL> {WS}+ {}
|
||||
<YYINITIAL> {FALLBACK_CH} { throw new ParseException(yychar, ParseException.ERROR_UNEXPECTED_CHAR, new Character(yycharat(0)));}
|
||||
<YYINITIAL> {FALLBACK_CH} { throw new ParseException(yychar, ParseException.ERROR_UNEXPECTED_CHAR, new Character(yycharat(0)));}
|
||||
|
||||
@@ -575,7 +575,7 @@ int getPosition(){
|
||||
}
|
||||
case 25: break;
|
||||
case 4:
|
||||
{ sb.delete(0, sb.length());yybegin(STRING_BEGIN);
|
||||
{ sb = null; sb = new StringBuffer(); yybegin(STRING_BEGIN);
|
||||
}
|
||||
case 26: break;
|
||||
case 16:
|
||||
|
||||
Reference in New Issue
Block a user