json: Reject unescaped control characters
commit340db1ed82f8ced40a3e778c08963005369e2926
authorMarkus Armbruster <armbru@redhat.com>
Thu, 23 Aug 2018 16:39:45 +0000 (23 18:39 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 24 Aug 2018 18:26:37 +0000 (24 20:26 +0200)
treec1fef7097ff604764f708120567b7aa608ff80be
parenta2ec6be72b80770b063cf08c95c78f0d36705355
json: Reject unescaped control characters

Fix the lexer to reject unescaped control characters in JSON strings,
in accordance with RFC 8259 "The JavaScript Object Notation (JSON)
Data Interchange Format".

Bonus: we now recover more nicely from unclosed strings.  E.g.

    {"one: 1}\n{"two": 2}

now recovers cleanly after the newline, where before the lexer
remained confused until the next unpaired double quote or lexical
error.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180823164025.12553-19-armbru@redhat.com>
qobject/json-lexer.c
tests/check-qjson.c
tests/qmp-test.c