qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 09/23] qobject: qobject_from_jsonv() is dange


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 09/23] qobject: qobject_from_jsonv() is dangerous, hide it away
Date: Fri, 27 Jul 2018 10:34:28 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 07/27/2018 10:13 AM, Markus Armbruster wrote:
qobject_from_jsonv() takes ownership of %p arguments.  On failure, we
can't generally know whether we failed before or after %p, so
ownership becomes indeterminate.  To avoid leaks, callers passing %p
must terminate on error, e.g. by passing &error_abort.  Trap for the
unwary; document and give the function internal linkage.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
  include/qapi/qmp/qjson.h |  2 --
  qobject/qjson.c          | 13 ++++++++++++-
  2 files changed, 12 insertions(+), 3 deletions(-)


Reviewed-by: Eric Blake <address@hidden>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

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