Index: gimp-2.6.11/plug-ins/common/file-psp.c
===================================================================
--- gimp-2.6.11.orig/plug-ins/common/file-psp.c
+++ gimp-2.6.11/plug-ins/common/file-psp.c
@@ -1246,13 +1246,14 @@ read_channel_data (FILE       *f,
             fread (buf, runcount, 1, f);
           if (bytespp == 1)
             {
+              runcount = MIN (runcount, endq - q);
               memmove (q, buf, runcount);
               q += runcount;
             }
           else
             {
               p = buf;
-              for (i = 0; i < runcount; i++)
+              for (i = 0; i < runcount && q < endq; i++)
                 {
                   *q = *p++;
                   q += bytespp;
