Bug 357559

Summary: crash on opening PSD file
Product: [Applications] krita Reporter: Alexander Opitz <opi>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: dimula73, halla
Priority: NOR Keywords: drkonqi
Version: 2.9.10   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alexander Opitz 2016-01-05 09:09:21 UTC
Application: krita (2.9.10)
KDE Platform Version: 4.14.13
Qt Version: 4.8.6
Operating System: Linux 4.2.0-22-generic x86_64
Distribution: Ubuntu 15.10

-- Information about the crash:
- What I was doing when the application crashed:
Opened a PSD file. The file is around 100MB but it is an internal project.

The crash can be reproduced every time.

-- Backtrace:
Application: Krita (krita), signal: Aborted
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f0a2cf00840 (LWP 6453))]

Thread 6 (Thread 0x7f09f3fff700 (LWP 6461)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f0a2aa84286 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007f0a2aa80063 in QSemaphore::acquire(int) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007f0a276993cb in KisTileDataPooler::waitForWork (this=0x2de9390) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/image/tiles3/kis_tile_data_pooler.cc:165
#4  KisTileDataPooler::run (this=0x2de9390) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/image/tiles3/kis_tile_data_pooler.cc:187
#5  0x00007f0a2aa83d1c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007f0a248856aa in start_thread (arg=0x7f09f3fff700) at pthread_create.c:333
#7  0x00007f0a2a1aceed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 5 (Thread 0x7f0a01ab6700 (LWP 6462)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f0a2aa84286 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007f0a2aa80483 in QSemaphore::tryAcquire(int, int) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007f0a276c1b03 in KisTileDataSwapper::waitForWork (this=<optimized out>) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:86
#4  0x00007f0a276c1d6a in KisTileDataSwapper::run (this=0x2de93d0) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:92
#5  0x00007f0a2aa83d1c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007f0a248856aa in start_thread (arg=0x7f0a01ab6700) at pthread_create.c:333
#7  0x00007f0a2a1aceed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 4 (Thread 0x7f0a0b091700 (LWP 6463)):
#0  0x00007f0a2a1a3743 in select () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f0a2abc0eff in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007f0a2abc6c5f in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007f0a2abc7118 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007f0a2ab920d1 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007f0a2ab92445 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007f0a2aa814f9 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007f0a2ab72133 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007f0a2aa83d1c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007f0a248856aa in start_thread (arg=0x7f0a0b091700) at pthread_create.c:333
#10 0x00007f0a2a1aceed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f0a012b5700 (LWP 6464)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f0a2aa84286 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007f0a2babf29c in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#3  0x00007f0a2aa83d1c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007f0a248856aa in start_thread (arg=0x7f0a012b5700) at pthread_create.c:333
#5  0x00007f0a2a1aceed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f09f35ad700 (LWP 6465)):
#0  0x00007f0a2a1a3743 in select () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f0a2abc0eff in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007f0a2abc6c5f in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007f0a2abc7118 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007f0a2ab920d1 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007f0a2ab92445 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007f0a2aa814f9 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007f0a2ab72133 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007f0a2aa83d1c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007f0a248856aa in start_thread (arg=0x7f09f35ad700) at pthread_create.c:333
#10 0x00007f0a2a1aceed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f0a2cf00840 (LWP 6453)):
[KCrash Handler]
#6  0x00007f0a2a0db267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#7  0x00007f0a2a0dceca in __GI_abort () at abort.c:89
#8  0x00007f0a2aa78ed5 in qt_message_output(QtMsgType, char const*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007f0a2aa79331 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#10 0x00007f0a2aa79c51 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11 0x00007f0a2785c799 in KisMask::Private::initSelectionImpl (this=0x87df390, copyFrom=..., parentLayer=..., copyFromDevice=...) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/image/kis_mask.cc:149
#12 0x00007f0a2785d9a3 in KisMask::initSelection (this=this@entry=0x87ded50, parentLayer=...) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/image/kis_mask.cc:144
#13 0x00007f09e2eaa9f9 in PSDLoader::decode (this=this@entry=0x7ffeec6ad4e0, uri=...) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/plugins/formats/psd/psd_loader.cpp:259
#14 0x00007f09e2ead61d in PSDLoader::buildImage (this=this@entry=0x7ffeec6ad4e0, uri=...) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/plugins/formats/psd/psd_loader.cpp:328
#15 0x00007f09e2ea7217 in psdImport::convert (this=<optimized out>, to=...) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/plugins/formats/psd/psd_import.cc:66
#16 0x00007f0a2c810712 in CalligraFilter::ChainLink::invokeFilter (this=0x373d650, parentChainLink=<optimized out>) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisFilterChainLink.cpp:90
#17 0x00007f0a2c80e7bd in KisFilterChain::invokeChain (this=0x3a56330) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisFilterChain.cpp:95
#18 0x00007f0a2c81f095 in KisImportExportManager::importDocument (this=0x388b6a0, url=..., documentMimeType=..., status=@0x7ffeec6adb30: KisImportExportFilter::StorageCreationError) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisImportExportManager.cpp:169
#19 0x00007f0a2c7f77e7 in KisDocument::openFile (this=0x39f8030) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisDocument.cpp:1337
#20 0x00007f0a2c7fdb81 in KisDocument::Private::openFile (this=0x3a5b440) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisDocument.cpp:379
#21 KisDocument::Private::openLocalFile (this=0x3a5b440) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisDocument.cpp:401
#22 0x00007f0a2c7fb3ea in KisDocument::openUrlInternal (this=this@entry=0x39f8030, url=...) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisDocument.cpp:2436
#23 0x00007f0a2c7fb617 in KisDocument::openUrl (this=this@entry=0x39f8030, _url=..., flags=flags@entry=KisDocument::OPEN_URL_FLAG_NONE) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisDocument.cpp:1240
#24 0x00007f0a2c82836d in KisMainWindow::openDocumentInternal (this=this@entry=0x2b8d120, url=..., newdoc=0x39f8030) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisMainWindow.cpp:711
#25 0x00007f0a2c7dfead in KisApplication::start (this=this@entry=0x7ffeec6ae530) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/ui/KisApplication.cpp:488
#26 0x00000000004028ed in main (argc=<optimized out>, argv=<optimized out>) at /build/krita-testing-msg5HH/krita-testing-2+git20151215+r45/krita/main.cc:192

Reported using DrKonqi
Comment 1 Halla Rempt 2016-01-05 09:50:34 UTC
Hi!

Thanks for your report. Could you mail the psd file privately to me (boud@kde.org) so I can try to reproduce it and fix it? Without an actual test file, fixing the bug is going to be next to impossible, I'm afraid. If needed, I can sign an NDA, that's no problem.
Comment 2 Alexander Opitz 2016-01-05 11:17:07 UTC
I dived a bit into the code. The illness comes from frame

#13 0x00007f09e2eaa9f9 in PSDLoader::decode https://github.com/KDE/krita/blob/master/krita/plugins/formats/psd/psd_loader.cpp#L259

newLayer seems null.

<code>
(gdb) f 13
(gdb) print newLayer
$4 = {d = 0x0}
</code>

This can only happen if layerRecord->infoBlocks.sectionDividerType != psd_other AND groupStack.isEmpty() (https://github.com/KDE/krita/blob/master/krita/plugins/formats/psd/psd_loader.cpp#L201 ff).

<code>
(gdb) print *layerRecord
$2 = {error = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 373059}, alloc = 0, size = 0, data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, 
      simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 2305}, alloc = 0, size = 0, 
      data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, 
    d = 0x7f26c4b14920 <QString::shared_null>, static codecForCStrings = 0x0}, top = 0, left = 0, bottom = 0, right = 0, nChannels = 5, channelInfoRecords = {{d = 0x3502080, 
      p = 0x3502080}}, blendModeKey = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 373059}, alloc = 0, size = 0, 
      data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {
        _q_value = 2305}, alloc = 0, size = 0, data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, 
      array = {0}}, d = 0x3502130, static codecForCStrings = 0x0}, isPassThrough = 97, opacity = 255 '\377', clipping = 0 '\000', transparencyProtected = false, visible = true, 
  irrelevant = true, layerMask = {top = 40, left = 368, bottom = 331, right = 1968, defaultColor = 255 '\377', positionedRelativeToLayer = false, disabled = false, 
    invertLayerMaskWhenBlending = false, userMaskDensity = 0 '\000', userMaskFeather = 0, vectorMaskDensity = 0 '\000', vectorMaskFeather = 0}, blendingRanges = {data = {
      static shared_null = {ref = {_q_value = 16700}, alloc = 0, size = 0, data = 0x9dc538 <QByteArray::shared_null+24> "", array = ""}, static shared_empty = {ref = {_q_value = 271}, 
        alloc = 0, size = 0, data = 0x7f26c4b147b8 <QByteArray::shared_empty+24> "", array = ""}, d = 0x3502160}, blackValues = "+", whiteValues = "g", 
    compositeGrayBlendDestinationRange = 7602281, sourceDestinationRanges = {{d = 0x7f26c4b14940 <QVectorData::shared_null>, p = 0x7f26c4b14940 <QVectorData::shared_null>}}}, 
  layerName = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 373059}, alloc = 0, size = 0, data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, 
      simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 2305}, alloc = 0, size = 0, 
      data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x35021f0, 
    static codecForCStrings = 0x0}, infoBlocks = {m_header = @0x7ffc3e96bad0, error = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 373059}, alloc = 0, 
        size = 0, data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, 
      static shared_empty = {ref = {_q_value = 2305}, alloc = 0, size = 0, data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, 
        capacity = 0, reserved = 0, array = {0}}, d = 0x7f26c4b14920 <QString::shared_null>, static codecForCStrings = 0x0}, keys = {<QList<QString>> = {{p = {static shared_null = {
              ref = {_q_value = 44294}, alloc = 0, begin = 0, end = 0, sharable = 1, array = {0x0}}, d = 0x35022f0}, d = 0x35022f0}}, <No data fields>}, unicodeLayerName = {
      static null = {<No data fields>}, static shared_null = {ref = {_q_value = 373059}, alloc = 0, size = 0, data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, simpletext = 0, 
        righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 2305}, alloc = 0, size = 0, 
        data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x35021f0, 
      static codecForCStrings = 0x0}, layerStyleXml = {<QDomNode> = {impl = 0x0}, <No data fields>}, embeddedPatterns = {{d = 0x7f26c4b14940 <QVectorData::shared_null>, 
        p = 0x7f26c4b14940 <QVectorData::shared_null>}}, sectionDividerType = psd_open_folder, sectionDividerBlendMode = {static null = {<No data fields>}, static shared_null = {ref = {
          _q_value = 373059}, alloc = 0, size = 0, data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, 
        reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 2305}, alloc = 0, size = 0, data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, simpletext = 0, 
        righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x3502290, static codecForCStrings = 0x0}, 
    m_layerInfoBlockHandler = {<boost::function1<bool, QIODevice*>> = {<boost::function_base> = {vtable = 0x0, functor = {obj_ptr = 0x74006900640064, type = {type = 0x74006900640064, 
              const_qualified = 105, volatile_qualified = false}, func_ptr = 0x74006900640064, bound_memfunc_ptr = {
              memfunc_ptr = (void (boost::detail::function::X::*)(boost::detail::function::X * const, int)) 0x74006900640064, this adjustment 27303545194610793, 
              obj_ptr = 0x61006c005f006c}, obj_ref = {obj_ptr = 0x74006900640064, is_const_qualified = 105, is_volatile_qualified = false}, 
            data = 100 'd'}}, <std::unary_function<QIODevice*, bool>> = {<No data fields>}, static args = <optimized out>, static arity = <optimized out>}, <No data fields>}}, 
  m_layerContentDevice = {d = 0x0}, m_onlyTransparencyMask = {d = 0x0}, m_onlyTransparencyMaskRect = {x1 = 0, y1 = 0, x2 = -1, y2 = -1}, m_transparencyMaskSizeOffset = 0, m_header = {
    signature = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 373059}, alloc = 0, size = 0, data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, 
        simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 2305}, alloc = 0, size = 0, 
        data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x2a5a860, 
      static codecForCStrings = 0x0}, version = 1, nChannels = 3, height = 2591, width = 6064, channelDepth = 8, colormode = RGB, error = {static null = {<No data fields>}, 
      static shared_null = {ref = {_q_value = 373059}, alloc = 0, size = 0, data = 0x7f26c4b1493a <QString::shared_null+26>, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, 
        capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 2305}, alloc = 0, size = 0, data = 0x7f26c4b1491a <QString::shared_empty+26>, clean = 0, 
        simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x7f26c4b14920 <QString::shared_null>, static codecForCStrings = 0x0}}}
</code>

As we can see "sectionDividerType = psd_open_folder" it is an open_folder so the stack seams empty. :-(

Will ask if I can send this PSD privately.
BTW: GimP 2.9.3 also stops reading the file. Older Photoshops are needing 26 GB HDD to show this file. *hugh*
Comment 3 Alexander Opitz 2016-01-05 14:04:41 UTC
Hi,

bad news, I'm not allowed to send the PSD file out. :-(
I can only tell, that it was generated with CS6.
Comment 4 Halla Rempt 2016-01-10 11:09:39 UTC
Would it be possible to just erase the content of the layers? This file must have a particular file structure to cause the this to happen, but I cannot recreate it.
Comment 5 Alexander Opitz 2016-01-11 11:14:48 UTC
Maybe, will look if I can get such a file.

The problem in source is that the PSDLoader::decode function can call KisMask::initSelection with an layer pointing to null. So also possibly damaged PSD files can crash Krita. So IMHO such layers should be ignored. (Happens if stack is empty)

This should IMHO fixed independently of this PSD.
Comment 6 Halla Rempt 2016-01-11 12:02:39 UTC
Definitely, but it will much easier to fix if we've got a file that triggers the issue.
Comment 7 Dmitry Kazakov 2016-01-22 18:32:37 UTC
Hi, Alexander!

I'm looking into your bug at the moment. I understand how this bug can appear, but I have no idea how it can happen. I mean in which way the specification of PSD should be broken, so the bug the conditions would be true. I still need an example PSD, otherwise my fix can make some layers be dropped while loading. You have two options:

1) Fill all the layers with data with a flat color and save it. Then send it to Boud or me (dimula73 at gmail.com).
2) Generate a new file with the same layer structure that still crashes Krita.

As I already said, my fix without an example file might break loading some files :(
Comment 8 Halla Rempt 2016-01-22 20:21:21 UTC
Right... We looked into it today (Dmitry is visiting my place), but without a test file we cannot go on, I'm afraid.
Comment 9 Dmitry Kazakov 2016-01-22 20:43:34 UTC
Git commit af2bbbaa2519081f68fbd20ebd3d4e84dfed56de by Dmitry Kazakov.
Committed on 22/01/2016 at 20:43.
Pushed by dkazakov into branch 'master'.

Add a workaround for an assert while loading some weird PSD files

We still need a test file to test what the problem is. This workaround
can cause some layers being lost/wrongly placed.

M  +23   -1    krita/plugins/formats/psd/psd_loader.cpp

http://commits.kde.org/krita/af2bbbaa2519081f68fbd20ebd3d4e84dfed56de
Comment 10 Alexander Opitz 2016-01-25 16:24:48 UTC
Hi,

I'm partly on it (as I don't have PS for myself). I need to drag down, which data can be cleared and which not (so the save still crashes Krita).
Comment 11 Dmitry Kazakov 2016-03-18 19:11:24 UTC
Git commit 02fefaaf1fa6aefc3f24a42ded3734fe47c34c2f by Dmitry Kazakov.
Committed on 18/03/2016 at 19:10.
Pushed by dkazakov into branch 'master'.

Fix PSD loading of groups layers that have only one layer
Fixes T1313

M  +21   -2    plugins/impex/psd/psd_loader.cpp

http://commits.kde.org/krita/02fefaaf1fa6aefc3f24a42ded3734fe47c34c2f