qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] QMP accepts double dict keys


From: Markus Armbruster
Subject: Re: [Qemu-devel] QMP accepts double dict keys
Date: Mon, 03 Dec 2018 20:48:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 12/3/18 10:30 AM, Max Reitz wrote:
>> Hi,
>>
>> QMP accepts double keys in dicts without complaining.  The value it is
>> using is apparently the last one specified:
>
> JSON says it is undefined what happens when a client passes double
> keys. We are probably best off if we teach our parser to be strict and
> reject doubled keys in QMP as invalid.

Not bug-compatible.  Do we care?

> Hmm - can a client abuse QMP with duplicate keys to cause qemu to leak
> memory?

No.  parse_pair() inserts with qdict_put_obj(), which replaces the old
value without leaking it.

>>
>> $ qemu-system-x86_64 -qmp stdio
>> {"QMP": {"version": {"qemu": {"micro": 93, "minor": 0, "major": 3},
>> "package": "v3.1.0-rc3-7-g87a45d86ed"}, "capabilities": []}}
>> {'execute':'qmp_capabilities'}
>> {"return": {}}
>> {'execute':'blockdev-add','arguments':{'driver':'null-co',
>>   'node-name':'foo','node-name':'bar'}}
>> {"return": {}}
>> {'execute':'query-named-block-nodes'}
>> {"return": [{ [...] "node-name": "bar" [...] }]}
>>
>> Another test case is iotest 229 which specifies both mode=absolute-paths
>> and mode=existing (it wants the latter).
>>
>> Max
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]