Changeset: 93bc892a8414 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/93bc892a8414
Modified Files:
monetdb5/modules/atoms/json.c
Branch: Jul2021
Log Message:
',' is strictly a separator in json.
diffs (39 lines):
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -1022,11 +1022,16 @@ JSONtoken(JSON *jt, const char *j, const
skipblancs(j);
if (*j == '}')
break;
- if (*j != '}' && *j != ',') {
+ if (*j != ',') {
jt->error = createException(MAL, "json.parser",
"JSON syntax error: ',' or '}' expected at offset %td", j - string_start);
return idx;
}
j++;
+ skipblancs(j);
+ if (*j == '}') {
+ jt->error = createException(MAL, "json.parser",
"JSON syntax error: '}' not expected at offset %td", j - string_start);
+ return idx;
+ }
}
if (*j != '}') {
jt->error = createException(MAL, "json.parser", "JSON
syntax error: '}' expected at offset %td", j - string_start);
@@ -1083,12 +1088,16 @@ JSONtoken(JSON *jt, const char *j, const
jt->error = createException(MAL, "json.parser",
"JSON syntax error: Array value expected at offset %td", j - string_start);
return idx;
}
- if (*j != ']' && *j != ',') {
+ if (*j != ',') {
jt->error = createException(MAL, "json.parser",
"JSON syntax error: ',' or ']' expected at offset %td (context: %c%c%c)", j -
string_start, *(j - 1), *j, *(j + 1));
return idx;
}
j++;
skipblancs(j);
+ if (*j == ']') {
+ jt->error = createException(MAL, "json.parser",
"JSON syntax error: '}' not expected at offset %td", j - string_start);
+ return idx;
+ }
}
if (*j != ']') {
jt->error = createException(MAL, "json.parser", "JSON
syntax error: ']' expected at offset %td", j - string_start);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list