From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V38QE-0005T4-D0 for qemu-devel@nongnu.org; Sat, 27 Jul 2013 13:36:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V37Sp-0002nH-6z for qemu-devel@nongnu.org; Sat, 27 Jul 2013 12:35:33 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:121:10e4::3]:56009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V36dD-0006gB-AD for qemu-devel@nongnu.org; Sat, 27 Jul 2013 11:42:07 -0400 From: Markus Armbruster Date: Sat, 27 Jul 2013 17:41:57 +0200 Message-Id: <1374939721-7876-6-git-send-email-armbru@redhat.com> In-Reply-To: <1374939721-7876-1-git-send-email-armbru@redhat.com> References: <1374939721-7876-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 5/9] qapi.py: Reject invalid characters in schema file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, akong@redhat.com, mdroth@linux.vnet.ibm.com Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- scripts/qapi.py | 2 ++ tests/qapi-schema/comments.err | 1 + tests/qapi-schema/comments.exit | 2 +- tests/qapi-schema/comments.out | 3 --- tests/qapi-schema/funny-char.err | 1 + tests/qapi-schema/funny-char.exit | 2 +- tests/qapi-schema/funny-char.out | 3 --- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 342d16c..0b48a1e 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -101,6 +101,8 @@ class QAPISchema: if self.cursor == len(self.src): self.tok = None return + elif not self.tok.isspace(): + raise QAPISchemaError(self, 'Stray "%s"' % self.tok) def get_members(self): expr = OrderedDict() diff --git a/tests/qapi-schema/comments.err b/tests/qapi-schema/comments.err index e69de29..4a82b26 100644 --- a/tests/qapi-schema/comments.err +++ b/tests/qapi-schema/comments.err @@ -0,0 +1 @@ +:2:33: Stray "#" diff --git a/tests/qapi-schema/comments.exit b/tests/qapi-schema/comments.exit index 573541a..d00491f 100644 --- a/tests/qapi-schema/comments.exit +++ b/tests/qapi-schema/comments.exit @@ -1 +1 @@ -0 +1 diff --git a/tests/qapi-schema/comments.out b/tests/qapi-schema/comments.out index e3bd904..e69de29 100644 --- a/tests/qapi-schema/comments.out +++ b/tests/qapi-schema/comments.out @@ -1,3 +0,0 @@ -[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])] -['Status'] -[] diff --git a/tests/qapi-schema/funny-char.err b/tests/qapi-schema/funny-char.err index e69de29..d3dd293 100644 --- a/tests/qapi-schema/funny-char.err +++ b/tests/qapi-schema/funny-char.err @@ -0,0 +1 @@ +:2:36: Stray ";" diff --git a/tests/qapi-schema/funny-char.exit b/tests/qapi-schema/funny-char.exit index 573541a..d00491f 100644 --- a/tests/qapi-schema/funny-char.exit +++ b/tests/qapi-schema/funny-char.exit @@ -1 +1 @@ -0 +1 diff --git a/tests/qapi-schema/funny-char.out b/tests/qapi-schema/funny-char.out index e3bd904..e69de29 100644 --- a/tests/qapi-schema/funny-char.out +++ b/tests/qapi-schema/funny-char.out @@ -1,3 +0,0 @@ -[OrderedDict([('enum', 'Status'), ('data', ['good', 'bad', 'ugly'])])] -['Status'] -[] -- 1.7.11.7