From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFS9Q-0003fW-6S for qemu-devel@nongnu.org; Mon, 17 Feb 2014 12:38:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFS9J-0002Aq-4q for qemu-devel@nongnu.org; Mon, 17 Feb 2014 12:38:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFS9I-0002Aj-RH for qemu-devel@nongnu.org; Mon, 17 Feb 2014 12:38:33 -0500 Message-ID: <53024915.9090702@redhat.com> Date: Mon, 17 Feb 2014 10:38:29 -0700 From: Eric Blake MIME-Version: 1.0 References: <1392637972-24719-1-git-send-email-marcel.a@redhat.com> In-Reply-To: <1392637972-24719-1-git-send-email-marcel.a@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6moQDdSpRmVKWiJltLFLM0Q8qntpEoLvl" Subject: Re: [Qemu-devel] [PATCH] qapi: output visitor crashes qemu if it encounters a NULL value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6moQDdSpRmVKWiJltLFLM0Q8qntpEoLvl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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? >=20 > Signed-off-by: Marcel Apfelbaum > --- > qapi/qmp-output-visitor.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > 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 =3D QTAILQ_LAST(&qov->stack, QStack); > + > + if (!e) { > + return NULL; > + } > + The code looks okay to me, but without a formula, my review is fairly wea= k: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --6moQDdSpRmVKWiJltLFLM0Q8qntpEoLvl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTAkkVAAoJEKeha0olJ0NqwBAIAJwbo4eirgvlg0rZAA02I3eI UgEnp7JD+IZx/cFJASYbPdpzkp3dSwTRjr4o31q8DJOfya0ZnaDHi1D/ovX4qmKF b8+fgmRGTXQZPPV+DvGrwHBGgCPUPmjBKkJKyFKGicKQAcMwXDOLMhqqAgs1DFqP tJ9aKiOfV5yw49e3/uRZ6aB0wuXCsSrf+sp2yKfMCITTe3CDlzriJjEjJ5gEdRRo 0q+zsFSvaDbsfMq2y/jPpTk5AN+djDogy2SjmyBaN/la6L2PQimLmcSlIX0D3NE0 7NDBlURWcJB+/OtEBWH2IH6j1fBnF3MYZulDqe3v4TKR/ZQiUF6wxUtjTItUfOA= =yQVC -----END PGP SIGNATURE----- --6moQDdSpRmVKWiJltLFLM0Q8qntpEoLvl--