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 559239 - Error while loading psd-data
Error while loading psd-data
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.6.2
Other All
: Normal minor
: 2.6
Assigned To: GIMP Bugs
GIMP Bugs
: 561298 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-11-04 08:40 UTC by Alexander Thiel
Modified: 2008-11-19 07:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample data (29.49 KB, application/x-zip-compressed)
2008-11-04 10:27 UTC, Alexander Thiel
Details

Description Alexander Thiel 2008-11-04 08:40:27 UTC
While opening any *.psd files i get following Error (in German):
"Das Öffnen von ..psd ist fehlgeschlagen:
Fehler beim Öffnen der psd-datei: Zu viele Ebenenkanäle:1279"
It occurs since Version 2.6.0 and persists till 2.6.2. In 2.4.2 these files could be opened correctly.
I installed Gimp in Vista x64(SP1) and in XP 32(SP3) on different workstations with the same result. Even uninstalling Gimp, deleting the folders, rebooting and reinstalling does not correct the problem.
Comment 1 Martin Nordholts 2008-11-04 09:03:23 UTC
Hi and thanks for the bug report! Please attach a small PSD that can be used to reproduce the problem.
Comment 2 Alexander Thiel 2008-11-04 10:27:11 UTC
Created attachment 121940 [details]
Sample data

Hello, this is the sample to my bug-report.
Comment 3 Martin Nordholts 2008-11-04 17:42:08 UTC
I can confirm the regression from 2.4.
Comment 4 Martin Nordholts 2008-11-04 18:05:18 UTC
It bails out here:

if (lyr_a[lidx]->num_channels > MAX_CHANNELS)
  {
    g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                 _("Too many channels in layer: %d"),
                 lyr_a[lidx]->num_channels);

    return NULL;
  }

in psd-load.c:542

with lyr_a[lidx]->num_channels = 1279. Obviously a bogus read. It shouldn't be too hard to compare how the 2.4 code behaves with how the 2.6 code behaves and fix this. Setting gnome-love.
Comment 5 Martin Nordholts 2008-11-18 06:35:15 UTC
*** Bug 561298 has been marked as a duplicate of this bug. ***
Comment 6 Sven Neumann 2008-11-18 07:54:59 UTC
We might want to bump of MAX_CHANNELS to fix this. But to me it sounds like 1279 should be enough. So there is likely a different problem here.

Dennis, since you wrote this code, you certainly have an idea of what's going wrong here, don't you?
Comment 7 Martin Nordholts 2008-11-18 15:56:44 UTC
I didn't make much sense of that comment. MAX_CHANNELS was even lower in 2.4, namely 30. The value 1279 is not relevant in any way at all, it's just an arbitrary value read from an arbitrary location in the PSD file. At least that is my current conclusion.

To fix this regression someone with enough motivation must simply run the PSD plug-ins of 2.4 and 2.6 in parallel and see how the fread() calls differ.
Comment 8 Martin Nordholts 2008-11-18 19:57:55 UTC
I got a bit curious about the cause of this bug...

The patch makes the .psd of this bug and the duplicated bug load, as well as the last .psd attached to bug 555222. The fix feels safe, especially since the 2.4 plug-in did not do any padding. The fix will be available in GIMP 2.6.3.

Commited to trunk (rev 27680) and gimp-2-6. 

2008-11-18  Martin Nordholts  <martinn@svn.gnome.org>

	Bug 559239 – Error while loading psd-data

	* plug-ins/file-psd/psd-layer-res-load.c (load_layer_resource):
	Layer resource data should not be padded.
Comment 9 Martin Nordholts 2008-11-19 07:01:05 UTC
For correctness, the 2.4 plug-in has the same channel limitation as 2.6, namely 56, not 30 as I stated earlier.