On 08/08/2018 07:03 AM, Markus Armbruster wrote:
The callback to consume JSON values takes QObject *json, Error *err.
If both are null, the callback is supposed to make up an error by
itself.  This sucks.

qjson.c's consume_json() neglects to do so, which makes
qobject_from_json() & friends return null instead of failing.  I
consider that a bug.

The culprit is json_message_process_token(): it passes two null
pointers when it runs into a lexical error or a limit violation.  Fix
it to pass a proper Error object then.  Update the callbacks:


+++ b/include/qapi/qmp/qerror.h
@@ -61,9 +61,6 @@
  #define QERR_IO_ERROR \
      "An IO error has occurred"
-#define QERR_JSON_PARSING \
-    "Invalid JSON syntax"
-

Bonus - one less of these annoying defines.

Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to