Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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: 14c3279 (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>
  • Loading branch information
Markus Armbruster committed May 9, 2023
1 parent a2836b3 commit 5b5fe0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/qapi/parser.py
Expand Up @@ -346,7 +346,7 @@ def accept(self, skip_comment: bool = True) -> None:
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))

Expand Down

0 comments on commit 5b5fe0e

Please sign in to comment.