Bug 465148 - Krita can not open PSD files with blurred vector masks
Summary: Krita can not open PSD files with blurred vector masks
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 5.1.5
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: amyspark
URL: https://invent.kde.org/graphics/krita...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-01 23:28 UTC by Ivan Kuckir
Modified: 2023-12-14 03:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
PSD file made in Adobe Photoshop (202.89 KB, image/vnd.adobe.photoshop)
2023-02-01 23:28 UTC, Ivan Kuckir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Kuckir 2023-02-01 23:28:05 UTC
Created attachment 155861 [details]
PSD file made in Adobe Photoshop

STEPS TO REPRODUCE
1. Open Adobe Photoshop or www.Photopea.com 
2. Draw a vector shape, e.g. a rectangle with a Rectangle tool.
3. Go to Window - Properties, set the "Feather" parameter to a non-zero value, save a PSD

When you open it in Krita, it says "The file Format cannot be parsed". I am attaching a sample PSD file made in Adobe Photoshop

I think you used a PSD parser from Gimp, which had an identical issue: https://gitlab.gnome.org/GNOME/gimp/-/issues/6659#note_1069838
Comment 1 amyspark 2023-02-02 00:37:54 UTC
Ack. Assigning.
Comment 2 amyspark 2023-04-22 02:19:39 UTC
These one have a layer mask record size of 28, so I need to understand first where the changes are, and the GIMP source code isn't easy to read so far.
Comment 3 Ivan Kuckir 2023-04-22 07:27:22 UTC
Look into the Adobes docs: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_22582
Comment 4 amyspark 2023-04-22 15:24:51 UTC
(In reply to Ivan Kuckir from comment #3)
> Look into the Adobes docs:
> https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_22582

Already did, it's a very subtle interpretation of "Layer mask / adjustment layer data" that needs to be changed.
Comment 5 amyspark 2023-04-22 15:25:13 UTC
Fixed in tomorrow's nightlies.
Comment 6 amyspark 2023-12-14 03:25:43 UTC
Git commit 48f04b57c926fd464f80f4823e7d956e53303e2e by L. E. Segovia.
Committed on 22/04/2023 at 15:23.
Pushed by lsegovia into branch 'krita/5.1'.

psd: fix interpretation of layer mask/adjustment layer data lengths

The standard says:
> Size of the data: Check the size and flags to determine what is or is not present. If zero, the following fields are not present

Up to 18 bytes can be read safely in this way. After the 2 bytes for padding
(if size == 20), the rest of the data is conditional on each flag allowing
the data, and the block length allowing the read.
(cherry picked from commit 291a841ec2bf72459b2c17b9106c7eafc766037c)

M  +118  -26   libs/psd/psd_layer_record.cpp

https://invent.kde.org/graphics/krita/commit/48f04b57c926fd464f80f4823e7d956e53303e2e
Comment 7 amyspark 2023-12-14 03:25:44 UTC
Git commit 48f04b57c926fd464f80f4823e7d956e53303e2e by L. E. Segovia.
Committed on 22/04/2023 at 15:23.
Pushed by lsegovia into branch 'krita/5.1'.

psd: fix interpretation of layer mask/adjustment layer data lengths

The standard says:
> Size of the data: Check the size and flags to determine what is or is not present. If zero, the following fields are not present

Up to 18 bytes can be read safely in this way. After the 2 bytes for padding
(if size == 20), the rest of the data is conditional on each flag allowing
the data, and the block length allowing the read.
(cherry picked from commit 291a841ec2bf72459b2c17b9106c7eafc766037c)

M  +118  -26   libs/psd/psd_layer_record.cpp

https://invent.kde.org/graphics/krita/commit/48f04b57c926fd464f80f4823e7d956e53303e2e
Comment 8 amyspark 2023-12-14 03:25:56 UTC
Git commit 291a841ec2bf72459b2c17b9106c7eafc766037c by L. E. Segovia.
Committed on 22/04/2023 at 15:23.
Pushed by lsegovia into branch 'master'.

psd: fix interpretation of layer mask/adjustment layer data lengths

The standard says:
> Size of the data: Check the size and flags to determine what is or is not present. If zero, the following fields are not present

Up to 18 bytes can be read safely in this way. After the 2 bytes for padding
(if size == 20), the rest of the data is conditional on each flag allowing
the data, and the block length allowing the read.

M  +118  -26   libs/psd/psd_layer_record.cpp

https://invent.kde.org/graphics/krita/commit/291a841ec2bf72459b2c17b9106c7eafc766037c
Comment 9 amyspark 2023-12-14 03:25:56 UTC
Git commit 291a841ec2bf72459b2c17b9106c7eafc766037c by L. E. Segovia.
Committed on 22/04/2023 at 15:23.
Pushed by lsegovia into branch 'master'.

psd: fix interpretation of layer mask/adjustment layer data lengths

The standard says:
> Size of the data: Check the size and flags to determine what is or is not present. If zero, the following fields are not present

Up to 18 bytes can be read safely in this way. After the 2 bytes for padding
(if size == 20), the rest of the data is conditional on each flag allowing
the data, and the block length allowing the read.

M  +118  -26   libs/psd/psd_layer_record.cpp

https://invent.kde.org/graphics/krita/commit/291a841ec2bf72459b2c17b9106c7eafc766037c