[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240203233600.gu4qci36fpnro3ui@begin>
Date: Sun, 4 Feb 2024 00:36:00 +0100
From: Samuel Thibault <samuel.thibault@...-lyon.org>
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, speakup@...ux-speakup.org
Subject: [PATCH] speakup: Fix 8bit characters from direct synth
When userland echoes 8bit characters to /dev/synth with e.g.
echo -e '\xe9' > /dev/synth
synth_write would get characters beyond 0x7f, and thus negative when
char is signed. When given to synth_buffer_add which takes a u16, this
would sign-extend and produce a U+ffxy character rather than U+xy.
Users thus get garbled text instead of accents in their output.
Let's fix this by making sure that we read unsigned characters.
Signed-off-by: Samuel Thibault <samuel.thibault@...-lyon.org>
Fixes: 89fc2ae80bb1 ("speakup: extend synth buffer to 16bit unicode characters")
Cc: stable@...r.kernel.org
---
drivers/accessibility/speakup/synth.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/accessibility/speakup/synth.c
+++ b/drivers/accessibility/speakup/synth.c
@@ -208,8 +208,9 @@ void spk_do_flush(void)
wake_up_process(speakup_task);
}
-void synth_write(const char *buf, size_t count)
+void synth_write(const char *_buf, size_t count)
{
+ const unsigned char *buf = (const unsigned char *) _buf;
while (count--)
synth_buffer_add(*buf++);
synth_start();
Powered by blists - more mailing lists