From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBCUi-00022D-IG for qemu-devel@nongnu.org; Thu, 09 Jun 2016 22:48:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBCUd-0006uU-KD for qemu-devel@nongnu.org; Thu, 09 Jun 2016 22:48:23 -0400 Received: from resqmta-po-08v.sys.comcast.net ([2001:558:fe16:19:96:114:154:167]:34635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBCUd-0006u3-DM for qemu-devel@nongnu.org; Thu, 09 Jun 2016 22:48:19 -0400 From: Eric Blake Date: Thu, 9 Jun 2016 20:48:05 -0600 Message-Id: <1465526889-8339-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH 0/4] Guarantee valid JSON in QMP, even for nonfinite numbers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: armbru@redhat.com Flesh out an idea that came up during my JSON visitor series. Semantic errors are nicer than lexical errors. While we generally consider any non-finite number a bug in our code (that is, we don't plan to expose them over QMP), at least we can guarantee that even with a bug in our code we are still giving the user valid JSON, similar to how we convert non-UTF-8 byte sequences to use the replacement character for valid UTF-8 output. I hit a couple of checkpatch false negatives in while writing this series; one was easy to fix, but the other stumped me. It doesn't help that checkpatch tweaks also trigger checkpatch warnings... Eric Blake (4): qobject: Correct JSON lexer grammar comments checkpatch: There is no qemu_strtod() qobject: Parse non-finite numbers, as an extension qobject: Output valid JSON for non-finite numbers qobject/json-lexer.c | 32 ++++++++++++++++++++------- qobject/json-parser.c | 13 +++++++++-- qobject/qjson.c | 15 ++++++++++--- tests/check-qjson.c | 61 ++++++++++++++++++++++++++++++++++++++++++++------- docs/qmp-spec.txt | 4 ++++ scripts/checkpatch.pl | 2 +- 6 files changed, 105 insertions(+), 22 deletions(-) -- 2.5.5