On 08/10/2018 08:52 AM, Markus Armbruster wrote:

+    /* lexical error: impossible byte outside string */
+    qtest_qmp_send_raw(qts, "{\xFF");

\xff is an impossible byte inside a string as well; plus it has
special meaning to at least QMP for commanding a parser reset. Is a
better byte more appropriate (maybe \x7f), either in replacement to
\xff or as an additional test?

\xFF is documented to have special meaning for QGA, but as far as the
code's concerned, it's a lexical error like any other.  I'm fixing the
documentation in PATCH 56.  Want me to move that patch to the front of
the series?

Might not hurt. We also have a potential design decision to make: for most lexical errors, we report the error (with QGA, the user then requests that the first valid command after the client's induced lexical error also include an 0xff reply byte so that the client can easily skip over all the line noise, including said error reports). Thus, we COULD decide to make our parser specifically accept 0xff as a new token, different from the lexical error token, so that it inhibits wasted error messages to the client on the grounds that the client sent it on purpose, differently from all other ways the client can use a lexical error to cause a reset.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to