mirror of
https://github.com/json-c/json-c.git
synced 2026-04-03 04:19:07 +08:00
Issue #260: add a check to prevent trivial loops in the object tree, even though it is up to the callers to avoid doing so in more complex cases.
This commit is contained in:
@@ -205,6 +205,12 @@ int main(int argc, char **argv)
|
||||
printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));
|
||||
|
||||
my_object = json_object_new_object();
|
||||
int rc = json_object_object_add(my_object, "abc", my_object);
|
||||
if (rc != -1)
|
||||
{
|
||||
printf("ERROR: able to successfully add object to itself!\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
json_object_object_add(my_object, "abc", json_object_new_int(12));
|
||||
json_object_object_add(my_object, "foo", json_object_new_string("bar"));
|
||||
json_object_object_add(my_object, "bool0", json_object_new_boolean(0));
|
||||
|
||||
Reference in New Issue
Block a user