aboutsummaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-08-23 18:39:53 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-08-24 20:26:37 +0200
commitb2da4a4d7537567b44db60b7b79cd14f64e48f2f (patch)
treeb4a2f02e72bb87c160592a9ec2b42dc67b44c393 /README
parent4b1c0cd7c7f9f9cf2e46c0a9c9cd88b2cba3decd (diff)
downloadqemu-b2da4a4d7537567b44db60b7b79cd14f64e48f2f.zip
qemu-b2da4a4d7537567b44db60b7b79cd14f64e48f2f.tar.gz
qemu-b2da4a4d7537567b44db60b7b79cd14f64e48f2f.tar.bz2
json: Leave rejecting invalid escape sequences to parser
Both lexer and parser reject invalid escape sequences in strings. The parser's check is useless. The lexer ends the token right after the first non-well-formed byte. This tends to lead to suboptimal error reporting. For instance, input {"abc\@ijk": 1} produces the tokens JSON_LCURLY { JSON_ERROR "abc\@ JSON_KEYWORD ijk JSON_ERROR ": 1}\n The parser then reports three errors Invalid JSON syntax JSON parse error, invalid keyword 'ijk' Invalid JSON syntax before it recovers at the newline. Drop the lexer's escape sequence checking, and make it accept the same characters after backslash it accepts elsewhere in strings. It now produces JSON_LCURLY { JSON_STRING "abc\@ijk" JSON_COLON : JSON_INTEGER 1 JSON_RCURLY and the parser reports just JSON parse error, invalid escape sequence in string While there, fix parse_string()'s inaccurate function comment. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-27-armbru@redhat.com>
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions