Received: from eggs.gnu.org ([2001:4830:134:3::10]:35545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrMta-0006u4-Ao for qemu-devel@nongnu.org; Wed, 28 Oct 2015 05:19:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrMtX-0001I5-7Q for qemu-devel@nongnu.org; Wed, 28 Oct 2015 05:19:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrMtX-0001I1-2L for qemu-devel@nongnu.org; Wed, 28 Oct 2015 05:19:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id A20CB374A00 for ; Wed, 28 Oct 2015 09:19:46 +0000 (UTC) From: Markus Armbruster References: <5617BAD9.8040205@redhat.com> <87zizo5tv3.fsf@blackfin.pond.sub.org> Date: Wed, 28 Oct 2015 10:19:44 +0100 In-Reply-To: <87zizo5tv3.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Mon, 12 Oct 2015 11:17:04 +0200") Message-ID: <8737wvmjtb.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] simple qmp core dump List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: "qemu-devel@nongnu.org" Markus Armbruster writes: > Eric Blake writes: > >> Just noticed this core dump (I was actually trying to exceed the 1024 >> hard-baked limit in qmp-input-visitor.c which tries to set an Error >> object, but it looks like that limit was unreachable due to this earlier >> assertion): >> >> $ printf '{"execute":"qmp_capabilities","id":%1025s' " " | tr ' ' { | >> ./x86_64-softmmu/qemu-system-x86_64 -nodefaults -qmp stdio >> {"QMP": {"version": {"qemu": {"micro": 50, "minor": 4, "major": 2}, >> "package": ""}, "capabilities": []}} >> main-loop: WARNING: I/O thread spun for 1000 iterations >> ** >> ERROR:qobject/json-parser.c:294:parser_context_peek_token: assertion >> failed: (ctxt->tokens.pos < ctxt->tokens.count) >> Aborted (core dumped) >> >> I don't know the best way to deal with a client that abuses QMP >> protocol, but it would at least be nice to not abort. > > Handwritten parser crashes, surprise, surprise. > > 1023 works, 1024 crashes. Need to dig to find out why. Regressed in commit 65c0f1e "json-parser: don't replicate tokens at each level of recursion", v1.2.0. Until then, we got a clean "{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}".