[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qapi: output visitor crashes qemu if it encount
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] qapi: output visitor crashes qemu if it encounters a NULL value |
Date: |
Mon, 17 Feb 2014 10:38:29 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 02/17/2014 04:52 AM, Marcel Apfelbaum wrote:
> A NULL value is not added to visitor's stack, but there
> is no check for that when the visitor tries to return
> that value, leading to Qemu crash.
Do you have an easy formula for reproducing the crash?
>
> Signed-off-by: Marcel Apfelbaum <address@hidden>
> ---
> qapi/qmp-output-visitor.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
> index 74a5684..0562f49 100644
> --- a/qapi/qmp-output-visitor.c
> +++ b/qapi/qmp-output-visitor.c
> @@ -66,6 +66,11 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
> static QObject *qmp_output_first(QmpOutputVisitor *qov)
> {
> QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
> +
> + if (!e) {
> + return NULL;
> + }
> +
The code looks okay to me, but without a formula, my review is fairly weak:
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature