mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
json: reject javascript comments
We have been allowing javascript style comments in JSON ever
since commit 9428f2c (v0.7.5), but qemu doesn't send them, and
they are not strict JSON. Reject them for now; if we can later
prove that it is worthwhile, we can reinstate it at that point
(or even make it conditional, by adding a bool parameter to
the libvirt entry point).
* src/util/virjson.c (virJSONValueFromString): Don't enable
comment parsing.
* tests/jsontest.c (mymain): Test it.
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
committed by
Michal Privoznik
parent
f2acaebd40
commit
54dbba5bc3
@@ -418,6 +418,7 @@ mymain(void)
|
||||
DO_TEST_PARSE_FAIL("incomplete keyword", "tr");
|
||||
DO_TEST_PARSE_FAIL("overdone keyword", "[ truest ]");
|
||||
DO_TEST_PARSE_FAIL("unknown keyword", "huh");
|
||||
DO_TEST_PARSE_FAIL("comments", "[ /* nope */\n1 // not this either\n]");
|
||||
|
||||
DO_TEST_PARSE_FAIL("object with numeric keys", "{ 1:1, 2:1, 3:2 }");
|
||||
DO_TEST_PARSE_FAIL("unterminated object", "{ \"1\":1, \"2\":1, \"3\":2");
|
||||
|
||||
Reference in New Issue
Block a user