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



commit 8fdeaddbe7f6ab7ec0af00c16c723b438f55daea
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.

 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 6d51f90996..b89ab4fc7e 100644
--- a/plug-ins/file-psd/psd-save.c
+++ b/plug-ins/file-psd/psd-save.c
@@ -1538,7 +1538,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]