Received: from eggs.gnu.org ([2001:4830:134:3::10]:56523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brhPT-000836-Jj for qemu-devel@nongnu.org; Wed, 05 Oct 2016 04:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brhPQ-0003IL-AQ for qemu-devel@nongnu.org; Wed, 05 Oct 2016 04:18:39 -0400 From: Markus Armbruster References: <20160922203927.28241-1-marcandre.lureau@redhat.com> <20160922203927.28241-3-marcandre.lureau@redhat.com> <87twcy4sr5.fsf@dusky.pond.sub.org> Date: Wed, 05 Oct 2016 10:18:33 +0200 In-Reply-To: <87twcy4sr5.fsf@dusky.pond.sub.org> (Markus Armbruster's message of "Thu, 29 Sep 2016 17:42:38 +0200") Message-ID: <871szv1a5i.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 2/3] qapi: fix crash when a parameter is missing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: qemu-devel@nongnu.org, paolo.bonzini@gmail.com, qemu-stable@nongnu.org Markus Armbruster writes: > Marc-Andr=C3=A9 Lureau writes: > >> Calling: >> >> { "execute": "qom-set", >> "arguments": { "path": "/machine", "property": "rtc-time" } } >> >> Will crash with: >> >> qapi/qapi-visit-core.c:277: visit_type_any: Assertion `!err !=3D !*obj' >> failed > > This is actually a recent regression. Let's add "Broken in commit > 5c678ee." Can do on commit. > >> Clear the obj and return an error. >> >> The patch also fixes a similar potential crash in qmp_input_type_null() >> by checking qmp_input_get_object() returned a valid qobj. >> >> Signed-off-by: Marc-Andr=C3=A9 Lureau >> Reviewed-by: Eric Blake I'd like to rephrase like this, if it's all right with you: qapi: Fix crash when 'any' or 'null' parameter is missing Unlike the other visit methods, visit_type_any() and visit_type_null() neglect to check whether qmp_input_get_object() succeeded. They crash when it fails. Reproducer: { "execute": "qom-set", "arguments": { "path": "/machine", "property": "rtc-time" } } Will crash with: qapi/qapi-visit-core.c:277: visit_type_any: Assertion `!err !=3D !*obj' failed Broken in commit 5c678ee. Fix by adding the missing error checks. Also: Reviewed-by: Markus Armbruster