Skip to content
Snippets Groups Projects
Commit 1394dc06 authored by Simran Singhal's avatar Simran Singhal Committed by Markus Armbruster
Browse files

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: 8d3265b3
Signed-off-by: default avatarSimran Singhal <singhalsimran0@gmail.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Message-Id: <20200402182848.GA3023@simran-Inspiron-5558>
Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
[Commit message rewritten to explain what's broken]
Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
parent 53ef8a92
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment