summary refs log tree commit diff stats
path: root/qobject/json-streamer.c
diff options
context:
space:
mode:
authorSimran Singhal <singhalsimran0@gmail.com>2020-04-02 23:58:48 +0530
committerMarkus Armbruster <armbru@redhat.com>2020-04-07 13:10:11 +0200
commit1394dc0690e7a1514bd6594322d5a2105e881769 (patch)
treeb80955ed48a68dc0b11a4570a03a8c08d92efca6 /qobject/json-streamer.c
parent53ef8a92eb04ee19640f5aad3bff36cd4a36c250 (diff)
downloadfocaccia-qemu-1394dc0690e7a1514bd6594322d5a2105e881769.tar.gz
focaccia-qemu-1394dc0690e7a1514bd6594322d5a2105e881769.zip
json: Fix check for unbalanced right curly brace
We immediately diagnose unbalanced right curly brace:

    $ qemu-kvm --nodefaults --nographic --qmp stdio
    {"QMP": {"version": {"qemu": {"micro": 91, "minor": 2, "major": 4},
    "package": "v5.0.0-rc1-1-gf6ce4a439a08"}, "capabilities": ["oob"]}}
    }
    {"error": {"class": "GenericError", "desc": "JSON parse error,
    expecting value"}}

except within square bracket:

    [}

The check for unbalanced braces has a typo.  Fix it.

Fixes: 8d3265b3d00db1071d1d3bf8433b4818088fdeb5
Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200402182848.GA3023@simran-Inspiron-5558>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message rewritten to explain what's broken]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qobject/json-streamer.c')
-rw-r--r--qobject/json-streamer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c
index 47dd7ea576..b93d97b995 100644
--- a/qobject/json-streamer.c
+++ b/qobject/json-streamer.c
@@ -85,7 +85,7 @@ void json_message_process_token(JSONLexer *lexer, GString *input,
     g_queue_push_tail(&parser->tokens, token);
 
     if ((parser->brace_count > 0 || parser->bracket_count > 0)
-        && parser->bracket_count >= 0 && parser->bracket_count >= 0) {
+        && parser->brace_count >= 0 && parser->bracket_count >= 0) {
         return;
     }