qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference
Date: Fri, 16 Dec 2011 07:55:46 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13

On 12/16/2011 06:01 AM, Paolo Bonzini wrote:
QAPI currently cannot deal with no object pushed to the stack,
and dereferences a NULL pointer.  This is visible with

     qom-get path=/i440fx/piix3 property=romfile

after static non-string properties are introduced.

I'm a bit confused about what's happening here. What's the significance of non-string properties?

Regards,

Anthony Liguori


Signed-off-by: Paolo Bonzini<address@hidden>
---
  qapi/qmp-output-visitor.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c
index f76d015..29575da 100644
--- a/qapi/qmp-output-visitor.c
+++ b/qapi/qmp-output-visitor.c
@@ -65,13 +65,13 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov)
  static QObject *qmp_output_first(QmpOutputVisitor *qov)
  {
      QStackEntry *e = QTAILQ_LAST(&qov->stack, QStack);
-    return e->value;
+    return e ? e->value : NULL;
  }

  static QObject *qmp_output_last(QmpOutputVisitor *qov)
  {
      QStackEntry *e = QTAILQ_FIRST(&qov->stack);
-    return e->value;
+    return e ? e->value : NULL;
  }

  static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name,




reply via email to

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