From: Amos Kong <akong@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH] json-lexer: fix escaped backslash in single-quoted string
Date: Wed, 18 Jun 2014 14:00:52 +0800 [thread overview]
Message-ID: <20140618060052.GA18929@z.redhat.com> (raw)
In-Reply-To: <1402647182-27592-1-git-send-email-pbonzini@redhat.com>
On Fri, Jun 13, 2014 at 10:13:02AM +0200, Paolo Bonzini wrote:
> This made the lexer wait for a closing *double* quote.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
> ---
> qobject/json-lexer.c | 4 ++--
> tests/check-qjson.c | 7 +++++++
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/qobject/json-lexer.c b/qobject/json-lexer.c
> index 440df60..b19623e 100644
> --- a/qobject/json-lexer.c
> +++ b/qobject/json-lexer.c
> @@ -138,8 +138,8 @@ static const uint8_t json_lexer[][256] = {
> ['n'] = IN_SQ_STRING,
> ['r'] = IN_SQ_STRING,
> ['t'] = IN_SQ_STRING,
> - ['/'] = IN_DQ_STRING,
> - ['\\'] = IN_DQ_STRING,
> + ['/'] = IN_SQ_STRING,
> + ['\\'] = IN_SQ_STRING,
> ['\''] = IN_SQ_STRING,
> ['\"'] = IN_SQ_STRING,
> ['u'] = IN_SQ_UCODE0,
> diff --git a/tests/check-qjson.c b/tests/check-qjson.c
> index 4e74548..95497a0 100644
> --- a/tests/check-qjson.c
> +++ b/tests/check-qjson.c
> @@ -45,6 +45,13 @@ static void escaped_string(void)
> { "\"single byte utf-8 \\u0020\"", "single byte utf-8 ", .skip = 1 },
> { "\"double byte utf-8 \\u00A2\"", "double byte utf-8 \xc2\xa2" },
> { "\"triple byte utf-8 \\u20AC\"", "triple byte utf-8 \xe2\x82\xac" },
> + { "'\\b'", "\b", .skip = 1 },
> + { "'\\f'", "\f", .skip = 1 },
> + { "'\\n'", "\n", .skip = 1 },
> + { "'\\r'", "\r", .skip = 1 },
> + { "'\\t'", "\t", .skip = 1 },
> + { "'\\/'", "/", .skip = 1 },
> + { "'\\\\'", "\\", .skip = 1 },
> {}
> };
>
> --
> 1.8.3.1
>
--
Amos.
next prev parent reply other threads:[~2014-06-18 6:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 8:13 [Qemu-devel] [PATCH] json-lexer: fix escaped backslash in single-quoted string Paolo Bonzini
2014-06-13 13:24 ` Eric Blake
2014-06-18 6:00 ` Amos Kong [this message]
2014-06-19 14:59 ` Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140618060052.GA18929@z.redhat.com \
--to=akong@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).