[gimp/gimp-2-10] plug-ins: fix using wrong offset for group layer masks in psd export.



commit fe077ff3b3607afe3421dc9397ac88624a5c3fdc
Author: Jacob Boerema <jgboerema gmail com>
Date:   Tue May 4 15:48:34 2021 -0400

    plug-ins: fix using wrong offset for group layer masks in psd export.
    
    Exporting to psd could result in very large files which often failed to
    load in both GIMP and PS when a group layer with a layer mask
    was present.
    
    Reported on our IRC channel with a sample xcf which made it
    possible to figure out the problem.
    
    (cherry picked from commit 8fdeaddbe7f6ab7ec0af00c16c723b438f55daea)

 plug-ins/file-psd/psd-save.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/file-psd/psd-save.c b/plug-ins/file-psd/psd-save.c
index 4f2be5d44c..2cdd4c81cd 100644
--- a/plug-ins/file-psd/psd-save.c
+++ b/plug-ins/file-psd/psd-save.c
@@ -1512,7 +1512,9 @@ write_pixel_data (FILE     *fd,
 
       if (ChanLenPosition)    /* Update total compressed length */
         {
-          fseek (fd, ChanLenPosition[bytes], SEEK_SET); /*+bytes OR SOMETHING*/
+          /* Mask follows other components so use that as offset. */
+          fseek (fd, ChanLenPosition[components], SEEK_SET);
+
           write_gint32 (fd, len, "channel data length");
           IFDBG printf ("\t\tUpdating data len to %d, at %ld\n", len, ftell(fd));
         }


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