qemu-patch-raspberry4/qga
Markus Armbruster 84a56f38b2 json: Pass lexical errors and limit violations to callback
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() 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:

* monitor.c's handle_qmp_command(): the code to make up an error is
  now dead, drop it.

* qga/main.c's process_event(): lumps the "both null" case together
  with the "not a JSON object" case.  The former is now gone.  The
  error message "Invalid JSON syntax" is misleading for the latter.
  Improve it to "Input must be a JSON object".

* qobject/qjson.c's consume_json(): no update; check-qjson
  demonstrates qobject_from_json() now sets an error on lexical
  errors, but still doesn't on some other errors.

* tests/libqtest.c's qmp_response(): the Error object is now reliable,
  so use it to improve the error message.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180823164025.12553-40-armbru@redhat.com>
2018-08-24 20:26:37 +02:00
..
installer qga-win: Fixing msi upgrade disallow in WiX file 2018-07-03 15:20:50 -05:00
vss-win32 qga-win: fix error-handling in getNameByStringSID() 2017-10-26 20:01:32 -05:00
channel-posix.c qga: use local path for local headers 2018-06-01 19:20:38 +03:00
channel-win32.c qga: use local path for local headers 2018-06-01 19:20:38 +03:00
channel.h qga: add systemd socket activation support 2017-03-06 00:54:18 -06:00
commands-posix.c qga: fix file descriptor leak 2018-07-16 15:05:58 -05:00
commands-win32.c qga-win: Handle fstrim for OSes lower than Win8 2018-07-23 18:45:21 -05:00
commands.c glib: bump min required glib library version to 2.40 2018-06-29 12:22:28 +01:00
guest-agent-command-state.c qga: use local path for local headers 2018-06-01 19:20:38 +03:00
guest-agent-core.h Include qmp-commands.h exactly where needed 2018-02-09 13:52:10 +01:00
main.c json: Pass lexical errors and limit violations to callback 2018-08-24 20:26:37 +02:00
Makefile.objs qapi: Move qapi-schema.json to qapi/, rename generated files 2018-03-02 13:45:57 -06:00
qapi-schema.json qga/schema: fix documentation for GuestOSInfo 2018-07-03 15:20:50 -05:00
service-win32.c qga: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
service-win32.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
vss-win32.c qga: use local path for local headers 2018-06-01 19:20:38 +03:00
vss-win32.h qga-win: Fix a bug where qemu-ga service is stuck during stop operation 2017-04-26 23:56:47 -05:00