From: "Måns Rullgård" <mans@mansr.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Robert Abel <rabel@robertabel.eu>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Willy Tarreau <w@1wt.eu>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH] auxdisplay: charlcd: fix x/y command parsing
Date: Wed, 05 Dec 2018 17:58:26 +0000 [thread overview]
Message-ID: <yw1xr2evkg8t.fsf@mansr.com> (raw)
In-Reply-To: <CANiq72=Xg--8vG0+JLsPykOUfXpo89R2H-pBLuMROnQjMui7qA@mail.gmail.com> (Miguel Ojeda's message of "Wed, 5 Dec 2018 17:47:31 +0100")
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> writes:
> Hi Mans,
>
> [CC'ing a few people involved previously on this]
>
> On Wed, Dec 5, 2018 at 2:53 PM Mans Rullgard <mans@mansr.com> wrote:
>>
>> Commit b34050fadb86 ("auxdisplay: charlcd: Fix and clean up handling of
>> x/y commands") fixed some problems by rewriting the parsing code,
>> but also broke things further by removing the check for a complete
>> command before attempting to parse it. As a result, parsing is
>> terminated at the first x or y character.
>
> Why is it necessary to check for ";" to be exactly at the end? Or, in
> other words, what requires it?
>
> If the syntax supported by parse_xy() is wrong for some reason, we
> should fix that (instead of adding a check before calling it).
Suppose the command "\e[Lx0y0;" is written to the device. The
charlcd_write_char() function adds one character at a time to the escape
sequence buffer. Once the 'L' has been seen, it calls
handle_lcd_special_code() after each additional character is added. On
encountering the 'x' this function will attempt to parse the command
using parse_xy(), which fails since it is incomplete. It is nonetheless
reported as processed, and the escape sequence is flushed. The
remainder of the command (i.e. "0y0;") is then displayed as text.
Since parse_xy() can never return success (true) unless there is a
semicolon, it is pointless to call it until we have seen one. With the
characters being added to the buffer one by one, it is enough to check
for semicolon at the end.
BTW, the parsing of this command has been broken since 3.2-rc1 due to
commit 129957069e6a.
--
Måns Rullgård
next prev parent reply other threads:[~2018-12-05 17:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 13:52 Mans Rullgard
2018-12-05 16:47 ` Miguel Ojeda
2018-12-05 17:58 ` Måns Rullgård [this message]
2018-12-06 10:06 ` Miguel Ojeda
2018-12-06 12:06 ` Måns Rullgård
2018-12-13 21:03 ` Miguel Ojeda
2018-12-14 12:15 ` Måns Rullgård
2018-12-14 15:50 ` Miguel Ojeda
2018-12-06 23:13 ` Robert Abel
2018-12-06 23:18 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yw1xr2evkg8t.fsf@mansr.com \
--to=mans@mansr.com \
--cc=andy.shevchenko@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=rabel@robertabel.eu \
--cc=w@1wt.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome