diff --unified --recursive --text --new-file --color gimp-2.10.30.old/plug-ins/common/file-psp.c gimp-2.10.30/plug-ins/common/file-psp.c
--- gimp-2.10.30.old/plug-ins/common/file-psp.c	2021-12-20 04:48:34.000000000 +0800
+++ gimp-2.10.30/plug-ins/common/file-psp.c	2026-03-23 18:19:49.868126151 +0800
@@ -1947,7 +1947,23 @@
 
       if (can_handle_layer)
         {
-          pixel = g_malloc0 (height * width * bytespp);
+          gint line_width = width * bytespp;
+
+          if (ia->depth < 8)
+            {
+              gint min_line_width = (((width * ia->depth + 7) / 8) + (ia->depth - 1)) / 4 * 4;
+
+              /* For small widths, when depth is 1, or 4, the number of bytes
+               * used can be larger than the width * bytespp. Adjust for that. */
+              if (min_line_width > line_width)
+                {
+                  IFDBG(3) g_message ("Adjusting line width from %d to %d\n",
+                                      line_width, min_line_width);
+                  line_width = min_line_width;
+                }
+            }
+
+          pixel = g_malloc0 (height * line_width);
           if (null_layer)
             {
               pixels = NULL;
@@ -1956,7 +1972,7 @@
             {
               pixels = g_new (guchar *, height);
               for (i = 0; i < height; i++)
-                pixels[i] = pixel + width * bytespp * i;
+                pixels[i] = pixel + line_width * i;
             }
 
           buffer = gimp_drawable_get_buffer (layer_ID);
