]> git.proxmox.com Git - mirror_qemu.git/commit
qapi: Restrict strings to printable ASCII
authorMarkus Armbruster <armbru@redhat.com>
Fri, 13 Sep 2019 20:13:39 +0000 (22:13 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 24 Sep 2019 12:07:22 +0000 (14:07 +0200)
commit56a8caff922df8d597895a49f55f2150bff3adb7
tree4f8d571a86db608c595d55d36c5fd0d687631626
parent05d6ecd049e814b8ce85c4a974218bafe468a627
qapi: Restrict strings to printable ASCII

RFC 8259 on string contents:

   All Unicode characters may be placed within the quotation marks,
   except for the characters that MUST be escaped: quotation mark,
   reverse solidus, and the control characters (U+0000 through
   U+001F).

The QAPI schema parser accepts both less and more than JSON: it
accepts only ASCII with \u (less), and accepts control characters
other than LF (new line) unescaped.  How it treats unescaped non-ASCII
input differs between Python 2 and Python 3.

Make it accept strictly less: require printable ASCII.  Drop support
for \b, \f, \n, \r, \t.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190913201349.24332-7-armbru@redhat.com>
14 files changed:
scripts/qapi/common.py
tests/Makefile.include
tests/qapi-schema/string-code-point-127.err [new file with mode: 0644]
tests/qapi-schema/string-code-point-127.exit [new file with mode: 0644]
tests/qapi-schema/string-code-point-127.json [new file with mode: 0644]
tests/qapi-schema/string-code-point-127.out [new file with mode: 0644]
tests/qapi-schema/string-code-point-31.err [new file with mode: 0644]
tests/qapi-schema/string-code-point-31.exit [new file with mode: 0644]
tests/qapi-schema/string-code-point-31.json [new file with mode: 0644]
tests/qapi-schema/string-code-point-31.out [new file with mode: 0644]
tests/qapi-schema/unicode-str.err [deleted file]
tests/qapi-schema/unicode-str.exit [deleted file]
tests/qapi-schema/unicode-str.json [deleted file]
tests/qapi-schema/unicode-str.out [deleted file]