]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-keyboard: Fix hang on read of incomplete terminal control sequence main
authorD Scott Phillips <scott@os.amperecomputing.com>
Mon, 26 Jan 2026 17:25:32 +0000 (09:25 -0800)
committerHans de Goede <johannes.goede@oss.qualcomm.com>
Tue, 27 Jan 2026 09:14:30 +0000 (10:14 +0100)
It's possible for a read from the terminal to provide a partial command
sequence, starting with the CSI ('\x1b\x5b') but not terminating with
its function character ('\x40'..'\x7e'). In that case, the input byte
handling loop would not terminate, causing plymouthd to hang both itself
and possibly completion of the boot.

Break from the input byte handling loop when an incomplete command
sequence is found so that the program does not hang. The incomplete
command sequence will remain in the input buffer so that a later
completion of the command sequence can be handled.

Fixes: b41e40e065c6 ("Add support for CSI sequences")
Fixes: plymouth/plymouth#321
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2433079
src/libply-splash-core/ply-keyboard.c

index 59f125fee1a2384bcb1d6280e72dd7176bf10f1b..dc19f5cc1c91371c563d089dd4780d32ab426cd7 100644 (file)
@@ -315,7 +315,7 @@ on_key_event (ply_keyboard_t *keyboard,
                                  */
                         }
                         if (csi_seq_size == 0) /* No final byte found */
-                                continue;
+                                break;
                         process_keyboard_input (keyboard, bytes + i, csi_seq_size);
                         i += csi_seq_size;
                         continue;