[gimp] plug-ins: PSD color block can have a non zero length even when mode is RGB.



commit 3d248dc66fa117e5e6a0f35e08da4242cba61935
Author: Jacob Boerema <jgboerema gmail com>
Date:   Wed May 12 16:07:26 2021 -0400

    plug-ins: PSD color block can have a non zero length even when mode is RGB.
    
    Not taking a non zero length into consideration caused us to read from the
    wrong location in certain cases and then fail loading.
    
    Always use the specified length to go to the correct location. This is not
    a guarantee that we will be able to correctly load the image but at least
    we won't read wrong data from the wrong location.

 plug-ins/file-psd/psd-load.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index 3f9eb924bb..7dc68e5c3b 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -457,6 +457,15 @@ read_color_mode_block (PSDimage      *img_a,
           return -1;
         }
     }
+  else
+    {
+      /* Apparently it's possible to have a non zero block_len here. */
+      if (! psd_seek (input, block_len, G_SEEK_CUR, error))
+        {
+          psd_set_error (error);
+          return -1;
+        }
+    }
 
   /* Create color map for bitmap image */
   if (img_a->color_mode == PSD_BITMAP)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]