Skip to content

Commit b6c8daf

Browse files
sthibaulgregkh
authored andcommitted
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 <[email protected]> Fixes: 89fc2ae ("speakup: extend synth buffer to 16bit unicode characters") Cc: [email protected] Link: https://lore.kernel.org/r/20240204155736.2oh4ot7tiaa2wpbh@begin Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 813f008 commit b6c8daf

File tree

1 file changed

+3
-1
lines changed
  • drivers/accessibility/speakup

1 file changed

+3
-1
lines changed

drivers/accessibility/speakup/synth.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ void spk_do_flush(void)
208208
wake_up_process(speakup_task);
209209
}
210210

211-
void synth_write(const char *buf, size_t count)
211+
void synth_write(const char *_buf, size_t count)
212212
{
213+
const unsigned char *buf = (const unsigned char *) _buf;
214+
213215
while (count--)
214216
synth_buffer_add(*buf++);
215217
synth_start();

0 commit comments

Comments
 (0)