After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 585665 - Exporting to PSD with a blank text layer creates a corrupt file
Exporting to PSD with a blank text layer creates a corrupt file
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.6.6
Other All
: Normal normal
: 2.6
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2009-06-13 18:02 UTC by Mike E
Modified: 2009-07-16 20:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch against 2.6.6 (343 bytes, patch)
2009-07-11 10:06 UTC, Massimo
committed Details | Review

Description Mike E 2009-06-13 18:02:23 UTC
Please describe the problem:
When creating a multi layer image (such as several layers of text) and exporting that file to PSD, the PSD file is corrupt and unreadable

Steps to reproduce:
1. Create a new image
2. With the text tool, create a new text layer, type in "test text"
3. With the text tool, create a another text layer, type in "test text 2"
4. With the text tool, create a another text layer, type in "test text 3"
5. Go back and edit the layer of "test text 2".  Remove all the text so that is blank, but do not delete the layer (i.e. a blank layer).
6. Save as PSD
7. Attempt to open the saved file



Actual results:
Gimp reports that the PSD file is corrupt

Expected results:
To be able to open and edit the file normally

Does this happen every time?
Yes

Other information:
If you have any questions, or would like a sample file that reproduces this bug, please email me.
Comment 1 Michael Schumacher 2009-06-15 09:59:40 UTC
Confirming.
Comment 2 Massimo 2009-07-11 10:06:43 UTC
Created attachment 138234 [details] [review]
Proposed patch against 2.6.6

In file 'plug-ins/file-psd/psd-save.c' the function
write_pascalstring miscomputes the number of zeros 
needed to pad an empty string. 

And a text layer with no text in it has no name, so 
after storing the name, the remainder of the file is 
misaligned.

The attached patch against the release 2.6.6 fixes the
problem.
Comment 3 Sven Neumann 2009-07-16 20:31:44 UTC
commit 48a6b0c59cbdfc07e904d7b000776b2ccc55504c
Author: Massimo Valentini <sixtysix@inwind.it>
Date:   Thu Jul 16 22:21:40 2009 +0200

    Bug 585665 – Exporting to PSD with a blank text layer creates a corrupt file
    
    Use write_gchar() to write an empty string, not write_gint16().

 plug-ins/file-psd/psd-save.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)