summary refs log tree commit diff stats
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-04-28 12:54:15 +0200
committerMarkus Armbruster <armbru@redhat.com>2023-05-09 08:51:58 +0200
commit5b5fe0e018891dc08bcce75f064015c42aeb46a4 (patch)
treebfd0741cdc1713fbe9d2d929bd77bf3ceec44f1e /scripts/qapi
parenta2836b32b02a1d774f8c2504cb368c05d74ad492 (diff)
downloadfocaccia-qemu-5b5fe0e018891dc08bcce75f064015c42aeb46a4.tar.gz
focaccia-qemu-5b5fe0e018891dc08bcce75f064015c42aeb46a4.zip
qapi: Fix crash on stray double quote character
When the lexer chokes on a stray character, its shows the characters
until the next structural character in the error message.  It uses a
regular expression to match a non-empty string of non-structural
characters.  Bug: the regular expression treats '"' as structural.
When the lexer chokes on '"', the match fails, and trips
must_match()'s assertion.  Fix the regular expression.

Fixes: 14c32795024c (qapi: Improve reporting of lexical errors)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230428105429.1687850-4-armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/parser.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 878f90b458..7b49d3ab05 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -346,7 +346,7 @@ class QAPISchemaParser:
             elif not self.tok.isspace():
                 # Show up to next structural, whitespace or quote
                 # character
-                match = must_match('[^[\\]{}:,\\s\'"]+',
+                match = must_match('[^[\\]{}:,\\s\']+',
                                    self.src[self.cursor-1:])
                 raise QAPIParseError(self, "stray '%s'" % match.group(0))