[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qobject: json-streamer: Remove double test
From: |
Eric Blake |
Subject: |
Re: [PATCH] qobject: json-streamer: Remove double test |
Date: |
Thu, 2 Apr 2020 08:19:32 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 4/2/20 8:12 AM, Eric Blake wrote:
On 4/2/20 7:13 AM, Simran Singhal wrote:
Remove the duplicate test "parser->bracket_count >= 0".
Signed-off-by: Simran Singhal <address@hidden>
---
qobject/json-streamer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(brace > 0 || bracket > 0) && brace >= 0 && bracket >= 0
What I missed was the typo: we checked bracket >= 0 twice, instead of
the intended brace >= 0 && bracket >= 0. This needs a v2.
Effect of the bug:
Note that we can diagnose when we have unbalanced ] with no matching [
while inside {}:
$ 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"}}
but that we fail to diagnose unbalanced } with no matching { while
inside []:
[}
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org