Package: release.debian.org
Severity: normal
Tags: trixie
X-Debbugs-Cc: [email protected]
Control: affects -1 + src:plymouth
User: [email protected]
Usertags: pu

[ Reason ]
The following vulnerabilities (without CVEs yet) have been identified and fixed 
upstream for plymouth:

1. ply-terminal-emulator: fix CUB cursor underflow:
  - https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/405

2. ply-image: fix integer overflow in BMP loader dimension handling:
  - https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/406

3. ply-throbber: bound scandir cleanup loop by entry count:
  - https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/407

4. ply-rich-text: bound move_character indices to array length
  - https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/408

5. ply-console-viewer: cancel pending timeouts on free:
  - https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/412

6. ply-utils: check open() result in check_secure_boot_settings()
  - https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/413

There was a MR created for this: 
https://salsa.debian.org/debian/plymouth/-/merge_requests/13
See bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1142108

All the patches are coming from upstream

[ Impact ]
This fixes a bunch of low security issues and one that upstream
described as "probably CVE worthy"

[ Tests ]
Installed on a debian 13 VM's and rebooted

[ Risks ]
(Discussion of the risks involved. E.g. code is trivial or
complex, alternatives available.)

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [ ] the issue is verified as fixed in unstable

This is not yet fixed in unstable, I'm hoping for a new upstream release
diff --git a/debian/changelog b/debian/changelog
index f7841429..30d7ba43 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+plymouth (24.004.60-5+deb13u1) trixie; urgency=medium
+
+  [ Dylan Aïssi ]
+  * Backport upstream fixes for several vulnerabilities (Closes: #1142108):
+    - ply-terminal-emulator: fix CUB cursor underflow
+    - ply-image: fix integer overflow in BMP loader dimension handling
+    - ply-throbber: bound scandir cleanup loop by entry count
+    - ply-rich-text: bound {remove,move}_character indices to array length
+    - ply-console-viewer: cancel pending timeouts on free
+    - ply-utils: check open() result in check_secure_boot_settings()
+
+ -- Laurent Bigonville <[email protected]>  Tue, 01 Dec 2026 16:34:17 +0100
+
 plymouth (24.004.60-5) unstable; urgency=medium
 
   * d/l/plymouth.hook: Avoid installing a font already present in the initramfs
diff --git 
a/debian/patches/ply-console-viewer-cancel-pending-timeouts-on-free.patch 
b/debian/patches/ply-console-viewer-cancel-pending-timeouts-on-free.patch
new file mode 100644
index 00000000..58663304
--- /dev/null
+++ b/debian/patches/ply-console-viewer-cancel-pending-timeouts-on-free.patch
@@ -0,0 +1,39 @@
+From: Mario Limonciello <[email protected]>
+Date: Thu, 9 Jul 2026 18:03:56 -0500
+Subject: [PATCH] ply-console-viewer: cancel pending timeouts on free
+
+on_terminal_emulator_output() arms a one-shot event-loop timeout via
+ply_event_loop_watch_for_timeout() with update_console_messages as the
+handler and the console_viewer as user_data. ply_console_viewer_free()
+freed the line list and the struct but never cancelled this pending
+timeout. If the splash was torn down while a terminal-output update was
+still queued, the timeout would later fire against freed memory,
+resulting in a use-after-free.
+
+Cancel the pending timeout with ply_event_loop_stop_watching_for_timeout()
+before freeing, matching the pattern used by ply_throbber_free() and
+others.
+
+Signed-off-by: Mario Limonciello <[email protected]>
+
+Origin: upstream, 
https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/86c3ddf6f29a7184f75a8754f0ef8e1952483284
+Forwarded: 
https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/412
+---
+ src/libply-splash-graphics/ply-console-viewer.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/libply-splash-graphics/ply-console-viewer.c 
b/src/libply-splash-graphics/ply-console-viewer.c
+index fe25089..fd05d6d 100644
+--- a/src/libply-splash-graphics/ply-console-viewer.c
++++ b/src/libply-splash-graphics/ply-console-viewer.c
+@@ -150,6 +150,10 @@ ply_console_viewer_free (ply_console_viewer_t 
*console_viewer)
+         if (console_viewer == NULL)
+                 return;
+ 
++        ply_event_loop_stop_watching_for_timeout (ply_event_loop_get_default 
(),
++                                                  
(ply_event_loop_timeout_handler_t)
++                                                  update_console_messages, 
console_viewer);
++
+         ply_list_foreach (console_viewer->message_labels, node) {
+                 console_message_label = ply_list_node_get_data (node);
+                 ply_label_free (console_message_label);
diff --git 
a/debian/patches/ply-image-fix-integer-overflow-in-BMP-loader-dimension-handling.patch
 
b/debian/patches/ply-image-fix-integer-overflow-in-BMP-loader-dimension-handling.patch
new file mode 100644
index 00000000..4fbcfd42
--- /dev/null
+++ 
b/debian/patches/ply-image-fix-integer-overflow-in-BMP-loader-dimension-handling.patch
@@ -0,0 +1,99 @@
+From: Mario Limonciello <[email protected]>
+Date: Thu, 9 Jul 2026 18:04:15 -0500
+Subject: [PATCH] ply-image: fix integer overflow in BMP loader dimension
+ handling
+
+ply_image_load_bmp() decodes the firmware-provided BGRT logo
+(/sys/firmware/acpi/bgrt/image) whose width and height come from the
+attacker-controlled DIB header. The buffer size was computed as
+"bmp_pitch * height" in 32-bit int, which can overflow to a small
+value and produce an undersized malloc() allocation. The subsequent
+row-by-row read loop then writes bmp_pitch * height bytes into that
+buffer, causing a heap overflow. The allocation was also guarded with
+assert(buf) instead of real error handling.
+
+Reject empty and implausibly large dimensions, compute the total size
+in 64-bit (uint64_t) with an explicit size_t overflow check before
+allocating, use that same size consistently in malloc() and fread(),
+and return false via the existing out: cleanup instead of asserting on
+allocation failure.
+
+Signed-off-by: Mario Limonciello <[email protected]>
+
+Origin: upstream, 
https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/fbb58bf57ae6d6381937b5d6d43655137b8c6143
+Forwarded: 
https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/406
+---
+ src/libply-splash-graphics/ply-image.c | 38 +++++++++++++++++++++++++++++++---
+ 1 file changed, 35 insertions(+), 3 deletions(-)
+
+diff --git a/src/libply-splash-graphics/ply-image.c 
b/src/libply-splash-graphics/ply-image.c
+index 2995fef..4a78b57 100644
+--- a/src/libply-splash-graphics/ply-image.c
++++ b/src/libply-splash-graphics/ply-image.c
+@@ -79,6 +79,11 @@ struct bmp_dib_header
+ 
+ const uint8_t png_header[8] = { 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a };
+ 
++/* Sane upper bound on a BMP image dimension. Boot logos are small; this
++ * generous cap keeps the pixel buffer size computation well clear of
++ * integer overflow. */
++#define PLY_IMAGE_BMP_MAX_DIMENSION 65535
++
+ ply_image_t *
+ ply_image_new (const char *filename)
+ {
+@@ -220,6 +225,7 @@ ply_image_load_bmp (ply_image_t *image,
+         struct bmp_file_header file_header;
+         struct bmp_dib_header dib_header;
+         uint8_t r, g, b, *buf, *src;
++        uint64_t bmp_size;
+         bool ret = false;
+ 
+         assert (image != NULL);
+@@ -236,17 +242,43 @@ ply_image_load_bmp (ply_image_t *image,
+             dib_header.compression != 0)
+                 return false;
+ 
++        /* abs(INT32_MIN) is undefined behavior; reject before taking
++         * absolute value. */
++        if (dib_header.height == INT32_MIN)
++                return false;
++
+         width = dib_header.width;
+         height = abs (dib_header.height);
++
++        /* Guard against malformed or hostile headers (e.g. the
++         * firmware-provided BGRT logo).  Rejecting empty and
++         * implausibly large dimensions ensures the buffer size
++         * computation below cannot overflow into an undersized
++         * allocation, which the row-by-row read loop would then
++         * overflow. */
++        if (width == 0 || height == 0 ||
++            width > PLY_IMAGE_BMP_MAX_DIMENSION ||
++            height > PLY_IMAGE_BMP_MAX_DIMENSION)
++                return false;
++
+         bmp_pitch = (3 * width + 3) & ~3;
+ 
+-        buf = malloc (bmp_pitch * height);
+-        assert (buf);
++        /* Compute the total size in 64-bit and reject anything that
++         * would not fit in size_t before allocating. */
++        bmp_size = (uint64_t) bmp_pitch * (uint64_t) height;
++#if SIZE_MAX < UINT64_MAX
++        if (bmp_size > SIZE_MAX)
++                return false;
++#endif
++
++        buf = malloc ((size_t) bmp_size);
++        if (buf == NULL)
++                return false;
+ 
+         if (fseek (fp, file_header.bitmap_offset, SEEK_SET) != 0)
+                 goto out;
+ 
+-        if (fread (buf, 1, bmp_pitch * height, fp) != bmp_pitch * height)
++        if (fread (buf, 1, (size_t) bmp_size, fp) != (size_t) bmp_size)
+                 goto out;
+ 
+         image->buffer = ply_pixel_buffer_new (width, height);
diff --git 
a/debian/patches/ply-rich-text-bound-remove-move-character-indices-to-array-length.patch
 
b/debian/patches/ply-rich-text-bound-remove-move-character-indices-to-array-length.patch
new file mode 100644
index 00000000..eb88881b
--- /dev/null
+++ 
b/debian/patches/ply-rich-text-bound-remove-move-character-indices-to-array-length.patch
@@ -0,0 +1,68 @@
+From: Mario Limonciello <[email protected]>
+Date: Thu, 9 Jul 2026 18:02:58 -0500
+Subject: [PATCH] ply-rich-text: bound {remove,move}_character indices to
+ array length
+
+ply_rich_text_move_character() guarded old_index and new_index only
+against span.offset + span.range, a logical cursor window maintained by
+the terminal emulator that can be advanced past the physical allocation
+backing the ply_array_t. When an index fell between the array's element
+count and the span limit, the function dereferenced a pointer past the
+allocation and NULLed an arbitrary slot, an out-of-bounds write.
+
+Bound both indices against the actual number of allocated character
+slots via ply_array_get_size() in addition to the existing span checks.
+
+Signed-off-by: Mario Limonciello <[email protected]>
+
+Origin: upstream, 
https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/634ebdc4a76af4f34ab4e48059a07f819ada772f
+Forwarded: 
https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/408
+---
+ src/libply-splash-core/ply-rich-text.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/src/libply-splash-core/ply-rich-text.c 
b/src/libply-splash-core/ply-rich-text.c
+index 8e65b42..63c5641 100644
+--- a/src/libply-splash-core/ply-rich-text.c
++++ b/src/libply-splash-core/ply-rich-text.c
+@@ -186,8 +186,10 @@ ply_rich_text_remove_character (ply_rich_text_t 
*rich_text,
+                                 size_t           character_index)
+ {
+         ply_rich_text_character_t **characters;
++        size_t number_of_characters;
+ 
+         characters = ply_rich_text_get_characters (rich_text);
++        number_of_characters = ply_array_get_size (rich_text->characters);
+ 
+         if (character_index < rich_text->span.offset)
+                 return;
+@@ -195,6 +197,8 @@ ply_rich_text_remove_character (ply_rich_text_t *rich_text,
+         if (character_index >= rich_text->span.offset + rich_text->span.range)
+                 return;
+ 
++        if (character_index >= number_of_characters)
++                return;
+ 
+         if (characters[character_index] == NULL)
+                 return;
+@@ -209,6 +213,7 @@ ply_rich_text_move_character (ply_rich_text_t *rich_text,
+                               size_t           new_index)
+ {
+         ply_rich_text_character_t **characters = ply_rich_text_get_characters 
(rich_text);
++        size_t number_of_characters = ply_array_get_size 
(rich_text->characters);
+ 
+         if (old_index < rich_text->span.offset)
+                 return;
+@@ -222,6 +227,12 @@ ply_rich_text_move_character (ply_rich_text_t *rich_text,
+         if (new_index >= rich_text->span.offset + rich_text->span.range)
+                 return;
+ 
++        if (old_index >= number_of_characters)
++                return;
++
++        if (new_index >= number_of_characters)
++                return;
++
+ 
+         characters[new_index] = characters[old_index];
+         characters[old_index] = NULL;
diff --git 
a/debian/patches/ply-terminal-emulator-fix-CUB-cursor-underflow.patch 
b/debian/patches/ply-terminal-emulator-fix-CUB-cursor-underflow.patch
new file mode 100644
index 00000000..ba4d77b1
--- /dev/null
+++ b/debian/patches/ply-terminal-emulator-fix-CUB-cursor-underflow.patch
@@ -0,0 +1,40 @@
+From: Mario Limonciello <[email protected]>
+Date: Thu, 9 Jul 2026 18:02:13 -0500
+Subject: [PATCH] ply-terminal-emulator: fix CUB cursor underflow
+
+The Cursor Back (CUB, ESC [ n D) handler bounded the requested step
+against string_length (the current line's allocated length) instead of
+against cursor_column. When the cursor was at column k but the line
+buffer was m > k chars long, sending ESC [ j D with k < j <= m took the
+else-branch and computed cursor_column = k - j. Since cursor_column is a
+size_t, this wrapped to ~SIZE_MAX, and the next printable byte then
+indexed the rich-text at that huge index, causing an out-of-bounds heap
+write.
+
+The emulator is fed from the boot console pty and /dev/kmsg, both
+reachable by unprivileged users.
+
+Bound the step against cursor_column instead, so the cursor clamps to
+column 0 rather than underflowing.
+
+Signed-off-by: Mario Limonciello <[email protected]>
+
+Origin: upstream, 
https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/12085162c539c2d4f3bc41778eef3b38a973cda5
+Forwarded: 
https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/405
+---
+ src/libply-splash-core/ply-terminal-emulator.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libply-splash-core/ply-terminal-emulator.c 
b/src/libply-splash-core/ply-terminal-emulator.c
+index d4aebc9..623effb 100644
+--- a/src/libply-splash-core/ply-terminal-emulator.c
++++ b/src/libply-splash-core/ply-terminal-emulator.c
+@@ -502,7 +502,7 @@ on_control_sequence_move_cursor_left 
(ply_terminal_emulator_t *terminal_emulator
+                 parameter = 1;
+         }
+ 
+-        if (parameter > string_length) {
++        if (parameter > terminal_emulator->cursor_column) {
+                 terminal_emulator->cursor_column = 0;
+         } else {
+                 terminal_emulator->cursor_column -= parameter;
diff --git 
a/debian/patches/ply-throbber-bound-scandir-cleanup-loop-by-entry-count.patch 
b/debian/patches/ply-throbber-bound-scandir-cleanup-loop-by-entry-count.patch
new file mode 100644
index 00000000..e02e9da1
--- /dev/null
+++ 
b/debian/patches/ply-throbber-bound-scandir-cleanup-loop-by-entry-count.patch
@@ -0,0 +1,36 @@
+From: Mario Limonciello <[email protected]>
+Date: Thu, 9 Jul 2026 18:02:32 -0500
+Subject: [PATCH] ply-throbber: bound scandir cleanup loop by entry count
+
+ply_throbber_add_frames() cleaned up the scandir(3) result array on the
+error path with `while (entries[i] != NULL)`. scandir returns an array of
+exactly number_of_entries elements and does not NULL-terminate it, so this
+loop read and free()d past the end of the array (out-of-bounds read / wild
+free) whenever a frame PNG failed to decode.
+
+Bound the cleanup loop by number_of_entries, matching the success-path
+iteration bound. The success loop frees each entry and sets it to NULL as
+it advances, so resuming the free from the current index only releases the
+not-yet-freed entries and introduces no double free.
+
+Signed-off-by: Mario Limonciello <[email protected]>
+
+Origin: upstream, 
https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/a8d7556ac7a82560b38140d8c0db757fd3b3d4eb
+Forwarded: 
https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/407
+---
+ src/libply-splash-graphics/ply-throbber.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libply-splash-graphics/ply-throbber.c 
b/src/libply-splash-graphics/ply-throbber.c
+index b0217be..ce2cc0b 100644
+--- a/src/libply-splash-graphics/ply-throbber.c
++++ b/src/libply-splash-graphics/ply-throbber.c
+@@ -274,7 +274,7 @@ out:
+         if (!load_finished) {
+                 ply_throbber_remove_frames (throbber);
+ 
+-                while (entries[i] != NULL) {
++                while (i < number_of_entries) {
+                         free (entries[i]);
+                         i++;
+                 }
diff --git 
a/debian/patches/ply-utils-check-open-result-in-check_secure_boot_settings.patch
 
b/debian/patches/ply-utils-check-open-result-in-check_secure_boot_settings.patch
new file mode 100644
index 00000000..2be06357
--- /dev/null
+++ 
b/debian/patches/ply-utils-check-open-result-in-check_secure_boot_settings.patch
@@ -0,0 +1,37 @@
+From: Mario Limonciello <[email protected]>
+Date: Thu, 9 Jul 2026 18:03:42 -0500
+Subject: [PATCH] ply-utils: check open() result in
+ check_secure_boot_settings()
+
+Previously check_secure_boot_settings() called open() and passed the
+result directly to read() and close() without checking for failure. On
+open() failure (e.g. ENOENT, EACCES) fd is -1, so read(-1, ...) and
+close(-1) were invoked and failed with EBADF. The function still
+returned false by accident, but this is poor hygiene and pollutes errno
+for the caller.
+
+Check the open() result and return false immediately when fd < 0,
+before touching read()/close().
+
+Signed-off-by: Mario Limonciello <[email protected]>
+
+Origin: upstream, 
https://gitlab.freedesktop.org/plymouth/plymouth/-/commit/ce919136ca5bc54c8dc27b855e66f41ed7b80b12
+Forwarded: 
https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/413
+---
+ src/libply/ply-utils.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c
+index 463f61c..d8844b1 100644
+--- a/src/libply/ply-utils.c
++++ b/src/libply/ply-utils.c
+@@ -1258,6 +1258,9 @@ check_secure_boot_settings (const char *filename)
+         uint8_t buf[5];
+ 
+         fd = open (filename, O_RDONLY);
++        if (fd < 0)
++                return false;
++
+         len = read (fd, buf, 5);
+         close (fd);
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 3c975de8..a7e00505 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,9 @@ drop-systemd-vconsole-setup-service.patch
 fallback-etc-default-keyboard.patch
 ply-boot-splash-Set-unbuffered-input-when-creating-a.patch
 0007-label-freetype-fix-fallback-not-working-when-fc-matc.patch
+ply-terminal-emulator-fix-CUB-cursor-underflow.patch
+ply-image-fix-integer-overflow-in-BMP-loader-dimension-handling.patch
+ply-throbber-bound-scandir-cleanup-loop-by-entry-count.patch
+ply-rich-text-bound-remove-move-character-indices-to-array-length.patch
+ply-console-viewer-cancel-pending-timeouts-on-free.patch
+ply-utils-check-open-result-in-check_secure_boot_settings.patch

Reply via email to