* [Qemu-devel] [PATCH] json-lexer: fix escaped backslash in single-quoted string
@ 2014-06-13 8:13 Paolo Bonzini
2014-06-13 13:24 ` Eric Blake
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-06-13 8:13 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru, lcapitulino
This made the lexer wait for a closing *double* quote.
Signed-off-by: Paolo Bonzini <pbonzini@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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] json-lexer: fix escaped backslash in single-quoted string
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
2014-06-19 14:59 ` Luiz Capitulino
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2014-06-13 13:24 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: armbru, lcapitulino
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
On 06/13/2014 02:13 AM, Paolo Bonzini wrote:
> This made the lexer wait for a closing *double* quote.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> qobject/json-lexer.c | 4 ++--
> tests/check-qjson.c | 7 +++++++
> 2 files changed, 9 insertions(+), 2 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] json-lexer: fix escaped backslash in single-quoted string
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
2014-06-19 14:59 ` Luiz Capitulino
2 siblings, 0 replies; 4+ messages in thread
From: Amos Kong @ 2014-06-18 6:00 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: lcapitulino, qemu-devel, armbru
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] json-lexer: fix escaped backslash in single-quoted string
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
@ 2014-06-19 14:59 ` Luiz Capitulino
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Capitulino @ 2014-06-19 14:59 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, armbru
On Fri, 13 Jun 2014 10:13:02 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:
> This made the lexer wait for a closing *double* quote.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Applied to the qmp branch, thanks.
> ---
> 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 },
> {}
> };
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-19 19:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-06-19 14:59 ` Luiz Capitulino
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).