From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx8vg-0000LL-Nk for qemu-devel@nongnu.org; Wed, 18 Jun 2014 02:01:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wx8va-000568-Jv for qemu-devel@nongnu.org; Wed, 18 Jun 2014 02:01:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wx8va-000564-B5 for qemu-devel@nongnu.org; Wed, 18 Jun 2014 02:00:58 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5I60uAF020338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 18 Jun 2014 02:00:56 -0400 Date: Wed, 18 Jun 2014 14:00:52 +0800 From: Amos Kong Message-ID: <20140618060052.GA18929@z.redhat.com> References: <1402647182-27592-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1402647182-27592-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] json-lexer: fix escaped backslash in single-quoted string List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@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 Reviewed-by: Amos Kong > --- > 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.