Bug 444844 - Cannot open psd file
Summary: Cannot open psd file
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Unclassified
Component: File formats (show other bugs)
Version: 4.4.8
Platform: Other Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-02 17:31 UTC by oxydeg27
Modified: 2022-07-18 12:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oxydeg27 2021-11-02 17:31:50 UTC
SUMMARY
Cannot open psd file (very large, 250 MB).

STEPS TO REPRODUCE
1.  Download this psd file: https://zunko.jp/sozai/zunkot/a1zunko54.psd
2.  File > Open

OBSERVED RESULT
Error log:
Could not open \\\E:\a1zunko54.psd
Reason: The file format cannot be parsed..

EXPECTED RESULT
File being opened.

SOFTWARE/OS VERSIONS
Windows: 10
Comment 1 Halla Rempt 2021-11-02 17:36:07 UTC
I can confirm. The image does open in Gimp 2.10. It also doesn't open in master.
Comment 2 Halla Rempt 2021-11-02 17:37:17 UTC
The file log output:

krita.file: pos: 0
krita.file: (valid: true, signature: "8BPS", version:1, number of channels: 4, height: 14399, width: 8268, channel depth: 8, color mode: RGB)
krita.file: Read header. pos: 26
krita.file: Read color mode block. pos: 30
krita.file: Image Resource Sectionlength: 24680 , starts at: 34
krita.file: Reading resource block
krita.file:     resource block identifier "0x0425 - (Photoshop 7.0) Caption digest. 16 bytes: RSA Data Security, MD5 message-digest algorithm" 1061
krita.file:     resource block name ""
krita.file:     resource block size 16
krita.file: resource block created. Type: 1061 name "" size 16 , 24652 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0424 - XMP data block" 1060
krita.file:     resource block name ""
krita.file:     resource block size 14782
krita.file: resource block created. Type: 1060 name "" size 14782 , 9858 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x043A - (Photoshop CS5) Print Information. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the current print settings in the document. The color management options." 1082
krita.file:     resource block name ""
krita.file:     resource block size 216
krita.file: resource block created. Type: 1082 name "" size 216 , 9630 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x043B - (Photoshop CS5) Print Style. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the current print style in the document. The printing marks, labels, ornaments, etc." 1083
krita.file:     resource block name ""
krita.file:     resource block size 558
krita.file: resource block created. Type: 1083 name "" size 558 , 9060 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x03ed - ResolutionInfo structure" 1005
krita.file:     resource block name ""
krita.file:     resource block size 16
krita.file: Reading RESN_INFO_1005
krita.file: hres 22936722 vres 22936722
krita.file: 349 1 2 349 1 2
krita.file: resource block created. Type: 1005 name "" size 16 , 9032 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0426 - (Photoshop 7.0) Print scale. 2 bytes style (0 = centered, 1 = size to fit, 2 = user defined). 4 bytes x location (floating point). 4 bytes y location (floating point). 4 bytes scale (floating point)" 1062
krita.file:     resource block name ""
krita.file:     resource block size 14
krita.file: resource block created. Type: 1062 name "" size 14 , 9006 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x03ee - Alpha channel names" 1006
krita.file:     resource block name ""
krita.file:     resource block size 10
krita.file: resource block created. Type: 1006 name "" size 10 , 8984 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0415 - Unicode alpha names" 1045
krita.file:     resource block name ""
krita.file:     resource block size 14
krita.file: resource block created. Type: 1045 name "" size 14 , 8958 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0435 - (Photoshop CS3) DisplayInfo structure to support floating point clors. Also see ID 1007. See Appendix A in Photoshop API Guide.pdf ." 1077
krita.file:     resource block name ""
krita.file:     resource block size 18
krita.file: resource block created. Type: 1077 name "" size 18 , 8928 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x041d - Alpha IDs" 1053
krita.file:     resource block name ""
krita.file:     resource block size 4
krita.file: resource block created. Type: 1053 name "" size 4 , 8912 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x040d - Global angle" 1037
krita.file:     resource block name ""
krita.file:     resource block size 4
krita.file: Reading GLOBAL_ANGLE_1037
krita.file: resource block created. Type: 1037 name "" size 4 , 8896 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0419 - Global altitude" 1049
krita.file:     resource block name ""
krita.file:     resource block size 4
krita.file: Reading GLOBAL_ALT_1049
krita.file: resource block created. Type: 1049 name "" size 4 , 8880 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x03f3 - Print flags" 1011
krita.file:     resource block name ""
krita.file:     resource block size 10
krita.file: resource block created. Type: 1011 name "" size 10 , 8858 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x2710 - Print flags" 10000
krita.file:     resource block name ""
krita.file:     resource block size 10
krita.file: resource block created. Type: 10000 name "" size 10 , 8836 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x03f5 - Colour halftoning info" 1013
krita.file:     resource block name ""
krita.file:     resource block size 72
krita.file: resource block created. Type: 1013 name "" size 72 , 8752 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x03f8 - Colour transfer functions" 1016
krita.file:     resource block name ""
krita.file:     resource block size 112
krita.file: resource block created. Type: 1016 name "" size 112 , 8628 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0400 - Layer state info" 1024
krita.file:     resource block name ""
krita.file:     resource block size 2
krita.file: resource block created. Type: 1024 name "" size 2 , 8614 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0402 - Layers group info" 1026
krita.file:     resource block name ""
krita.file:     resource block size 8
krita.file: resource block created. Type: 1026 name "" size 8 , 8594 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0430 - (Photoshop CS2) Layer Group(s) Enabled ID. 1 byte for each layer in the document, repeated by length of the resource. NOTE: Layer groups have start and end markers" 1072
krita.file:     resource block name ""
krita.file:     resource block size 4
krita.file: resource block created. Type: 1072 name "" size 4 , 8578 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x042D - (Photoshop CS2) Layer Selection ID(s). 2 bytes count, following is repeated for each count: 4 bytes layer ID" 1069
krita.file:     resource block name ""
krita.file:     resource block size 6
krita.file: resource block created. Type: 1069 name "" size 6 , 8560 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0408 - Grid & guide info" 1032
krita.file:     resource block name ""
krita.file:     resource block size 16
krita.file: resource block created. Type: 1032 name "" size 16 , 8532 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x041e - URL list - unicode" 1054
krita.file:     resource block name ""
krita.file:     resource block size 4
krita.file: resource block created. Type: 1054 name "" size 4 , 8516 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x041a - Slices" 1050
krita.file:     resource block name ""
krita.file:     resource block size 822
krita.file: resource block created. Type: 1050 name "" size 822 , 7682 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0428 - (Photoshop CS) Pixel Aspect Ratio. 4 bytes (version = 1 or 2), 8 bytes double, x / y of a pixel. Version 2, attempting to correct values for NTSC and PAL, previously off by a factor of approx. 5%." 1064
krita.file:     resource block name ""
krita.file:     resource block size 12
krita.file: resource block created. Type: 1064 name "" size 12 , 7658 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x040f - ICC Profile" 1039
krita.file:     resource block name ""
krita.file:     resource block size 3144
krita.file: Reading ICC_PROFILE_1039
krita.file: resource block created. Type: 1039 name "" size 3144 , 4502 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0414 - Document specific IDs" 1044
krita.file:     resource block name ""
krita.file:     resource block size 4
krita.file: resource block created. Type: 1044 name "" size 4 , 4486 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x040c - Thumbnail resource" 1036
krita.file:     resource block name ""
krita.file:     resource block size 4062
krita.file: resource block created. Type: 1036 name "" size 4062 , 412 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0421 - Version info" 1057
krita.file:     resource block name ""
krita.file:     resource block size 86
krita.file: resource block created. Type: 1057 name "" size 86 , 314 bytes to go
krita.file: Reading resource block
krita.file:     resource block identifier "0x0422 - (Photoshop 7.0) EXIF data 1. See http://www.kodak.com/global/plugins/acrobat/en/service/digCam/exifStandard2.pdf" 1058
krita.file:     resource block name ""
krita.file:     resource block size 302
krita.file: resource block created. Type: 1058 name "" size 302 , 0 bytes to go
krita.file: Read 29 Image Resource Blocks
krita.file: Read image resource section. pos: 24714
krita.file: (PSD) reading layer section. Pos: 24714 bytes left: 257892214
krita.file: failed reading layer/mask section:  "Could not read layer block size. Got 354030552. Bytes left 257892210"
Comment 3 Halla Rempt 2022-07-18 12:34:22 UTC
Which application created this file? It looks like it is genuinely invalid.
Comment 4 Dmitry Kazakov 2022-07-18 12:49:33 UTC
Git commit d700876041287241773ed8dda6456e38b1058be2 by Dmitry Kazakov.
Committed on 18/07/2022 at 12:49.
Pushed by dkazakov into branch 'master'.

Let Krita open invalid PSD files

Some weird web apps generate invalid invalid PSD files with the
layer-mask-section size tag set incorrectly. We can still make some
effort on trying to load these file, though we give no guarantess.

M  +23   -13   libs/psd/psd_layer_section.cpp
M  +0    -3    libs/psd/psd_layer_section.h

https://invent.kde.org/graphics/krita/commit/d700876041287241773ed8dda6456e38b1058be2
Comment 5 Dmitry Kazakov 2022-07-18 12:49:44 UTC
Git commit 2cd456c4549e7dfb4934290e1d311b403cca8e4b by Dmitry Kazakov.
Committed on 18/07/2022 at 12:49.
Pushed by dkazakov into branch 'krita/5.1'.

Let Krita open invalid PSD files

Some weird web apps generate invalid invalid PSD files with the
layer-mask-section size tag set incorrectly. We can still make some
effort on trying to load these file, though we give no guarantess.

M  +23   -13   libs/psd/psd_layer_section.cpp
M  +0    -3    libs/psd/psd_layer_section.h

https://invent.kde.org/graphics/krita/commit/2cd456c4549e7dfb4934290e1d311b403cca8e4b