Exception whenever saving PSD files > 200 MB AND large dimensions: The starting position is out of stream bounds

Hello, we’ve detected a problem where whenever we try to save any PSD greater than 200MB in size AND of a certain dimension or larger (15600px x 10800px @ 300dpi or larger) , it throws the following exception:

Message=“The starting position is out of stream bounds. (Parameter ‘position’)”

We are using version 24.1.0 of Aspose.PSD (.net version).

Even a simple loading and saving of a PSD file that’s 200MB or larger AND 15600px x 10800px @ 300dpi or larger will cause the problem with the following code which all it does is load the file and save it (no manipulation of layers)

    private MemoryStream SimpleExample()
    {
        PsdLoadOptions loadOptions = new PsdLoadOptions()
        {
            LoadEffectsResource = true,
            UseDiskForLoadEffectsResource = true
        };


        using (var im = (PsdImage) Aspose.PSD.Image.Load("c:\\temp\\bigfile.psd", loadOptions))
        {

            try
            {

                MemoryStream saveAsStream = new MemoryStream();
                im.Save(saveAsStream);   //Exception happens here

                return saveAsStream;
            }
            catch (Exception e)
            {
                return null;
            }
        }
    }

This problem occurs on every file with that size AND dimension or greater however what is interesting is that if you have a file that’s 100MB AND 15600px x 10800px, it will save fine without throwing an exception.

To eliminate the possibility that there’s something wrong with our PSD files, we created a brand new simple PSD file from scratch (referenced as bigfile.psd) in the code that’s 15600px x 10800px @ 300dpi which has only 1 layer that is filled with the bucket tool with the color #414141. The result of this is a file that is greater than 200MBs and 15600px x 10800px @ 300dpi and it will throw the aforementioned exception. If you delete half of the layer (that you filled with the Color #414141), the file size will drop to a little over 100MBs instead of 200MBs, and the save operation will work fine without throwing an exception so again, it’s a problem that’s a combination of the file size AND the dimension being greater than a certain threshold together (we have files that are smaller in dimensions that are over 200MBs in size that all work fine for instance).

Here’s a link to download bigfile.psd: bigfile.psd

We would greatly appreciate your help as this is a showstopper bug for us and will be happy to provide any additional information to help you reproduce the problem. Thanks!

@abrosti
Thank you for the high quality bug report. I can confirm this issue.
We have opened the following new ticket(s) in our internal issue tracking system with the high priority and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-1957

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @Dmitriy.Sorokin , thanks for the response and for creating a high priority ticket for this. Would you happen to have a rough estimate of when you think this bug will get fixed and in what release? The only reason I ask is that this bug is blocking us from going to production so I just want to give our team a rough timeline of how long it will be delayed by. Thanks again for your help!

@abrosti Aspose.PSD team starts this ticket in this month, depending on the complexity and load of the team this will be fixed in 24.3 or 24.4

Hello again @Dmitriy.Sorokin. Would you know if there’s any kind of temporary workaround for this while PSDNET-1957 is getting fixed?

@abrosti unfortunately only one option is to use “ReadOnlyMode”, but it’s significantly limits the cases of using.

        PsdLoadOptions loadOptions = new PsdLoadOptions()
        {
            LoadEffectsResource = true,
            UseDiskForLoadEffectsResource = true,
            ReadOnlyMode = true
        };

This task has “High” priority. We will try to deliver its fix in 24.4.

Hi @Dmitriy.Sorokin , I just updated Aspose.PSD to 24.4.0 and it looks like the issue is still there. Did this not make it to 24.4?

The issue is fixed and now in the code review status. Unfortunately we didn’t have time to test and add this fix to 24.4, so it should appear in 24.5

The issues you have found earlier (filed as PSDNET-1957) have been fixed in this update. This message was posted using Bugs notification tool by yaroslav.lisovskyi

Hi @Dmitriy.Sorokin unfortunately this bug is not fixed. While it no longer throws an exception, it deletes the second half of the artwork (the first half from top to bottom is there, but the second half is deleted). If you guys can’t reproduce this, I’ll try to come up with reproduction scenario again.

@abrosti
It looks this bug consists of several subtasks. The Team fixed preview, but the inner data of psd file was lost.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-2052

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Dmitriy.Sorokin so are you saying that they’re aware of the issue and can reproduce it? If so, do you know how much longer we have to wait for the subtasks to get fixed?

@abrosti I wasn’t aware of this issue, but can confirm this. It looks like this bug passed the QA because of the correct PSD Preview with the incorrect internal LayerData. This task marked as prioritized and will be fixed in the next releases ASAP.

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as PSDNET-2052) have been fixed in this update. This message was posted using Bugs notification tool by yaroslav.lisovskyi

Hi @Dmitriy.Sorokin , I can confirm that this bug has been fixed in the latest release. Thanks for all of your help on this.

1 Like

Hi @Dmitriy.Sorokin , this issue has come back. I’m not sure as of which version it regressed but it’s defintiely back in the latest version of the library (in version 24.6.0 it is fine however)

@abrosti
Could you please clarify, Is this bug is reproducable for the old input file that was in PSDNET-1957 or with file larger than 200mb but with some peculiar properties?

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-2294

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @Dmitriy.Sorokin , yes you should be able to reproduce it with the old input file and instructions.

@abrosti thank you. we will check and then I’ll text you back.

1 Like