fix(#887): double array breaking JSONTokener.nextValue

change(#887): input validation
This commit is contained in:
rikkarth
2024-04-21 11:03:15 +01:00
parent ce074e9f9a
commit 3dcd5b2fab
3 changed files with 20 additions and 20 deletions

View File

@@ -440,7 +440,7 @@ public class JSONTokener {
case '[':
this.back();
try {
return new JSONArray(this);
return new JSONArray(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
@@ -516,6 +516,10 @@ public class JSONTokener {
String string = sb.toString().trim();
if (string.isEmpty()) {
throw this.syntaxError("Missing value");
}
if (strictMode) {
boolean isBooleanOrNumeric = checkIfValueIsBooleanOrNumeric(string);
@@ -526,9 +530,6 @@ public class JSONTokener {
throw new JSONException(String.format("Value is not surrounded by quotes: %s", string));
}
if (string.isEmpty()) {
throw this.syntaxError("Missing value");
}
return JSONObject.stringToValue(string);
}