Commit graph

12 commits

Author SHA1 Message Date
Michael Roth
c1990ebfa1 json-parser: add handling for NULL token list
Currently a NULL token list will crash the parser, instead we have it
pass back a NULL QObject.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-07 13:52:11 -05:00
Anthony Liguori
11e8a46cc3 json-parser: detect premature EOI
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-07 13:52:11 -05:00
Anthony Liguori
ef749d07e7 json-parser: propagate error from parser
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-07 13:52:10 -05:00
Stefan Weil
8b7968f7c4 Use GCC_FMT_ATTR (format checking)
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-03 06:34:51 +00:00
Anthony Liguori
a2da0395c1 Merge remote branch 'qmp/for-anthony' into staging 2010-06-14 09:39:01 -05:00
Paul Brook
11165820d1 Move stdbool.h
Move inclusion of stdbool.h to common header files, instead of including
in an ad-hoc manner.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-06-13 19:00:50 +01:00
Luiz Capitulino
bd0326950f qjson: Handle "\f"
It's valid JSON and should be handled.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-06-11 15:25:14 -03:00
Amos Kong
c96c84a9ff json-parser: Output the content of invalid keyword
When input some invalid word 'unknowcmd' through QMP port, qemu outputs
this error message:
  "parse error: invalid keyword `%s'"

This patch makes qemu output the content of invalid keyword, like:

  "parse error: invalid keyword `unknowcmd'"

Signed-off-by: Amos Kong <akong@redhat.com>
Acked-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-27 13:51:01 +01:00
Kevin Wolf
d758d90fe1 json-parser: Fix segfault on malformed input
If the parser fails to parse the key in parse_pair, it will access a NULL
pointer. A simple way to trigger this is sending {foo} via QMP. This patch
turns the segfault into a syntax error reply.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-06 22:32:54 +01:00
Roy Tam
2c0d4b36e7 json: fix PRId64 on Win32
OK we are fooled by the json lexer and parser. As we use %I64d to
print 'long long' variables in Win32, but lexer and parser only deal
with %lld but not %I64d, this patch add support for %I64d and solve
'info pci', 'powser_reset' and 'power_powerdown' assert failure in
Win32.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-10 12:47:58 -06:00
Amit Shah
2da69c8d12 json-parser: remove dead increment
clang-analyzer points out a redundant increment.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-13 17:14:15 -06:00
Anthony Liguori
4a5fcab7ac Add a JSON parser
This is the third and final stage of the JSON parser.  It parses lexical tokens
performing grammar validation and creating the final QObject representation.  It
uses a recursive decent parser.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-17 08:49:39 -06:00