Don't skip past \0 when parsing JSON objects.

A better solution might be to use -1 instead 0 to represent EOF everywhere,
which of course means changing `char` variables to `int`. The solution here is
enough to solve the immediate problem, though.

Fixes #758.
This commit is contained in:
Éamonn McManus
2023-08-01 13:11:25 -07:00
parent 402db6ad84
commit c8a9e15a57
2 changed files with 14 additions and 1 deletions

View File

@@ -253,7 +253,11 @@ public class JSONObject {
switch (x.nextClean()) {
case ';':
case ',':
if (x.nextClean() == '}') {
c = x.nextClean();
if (c == 0) {
throw x.syntaxError("A JSONObject text must end with '}'");
}
if (c == '}') {
return;
}
x.back();