Summary: | crash on opening PSD file | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | Alexander Opitz <opi> |
Component: | General | Assignee: | 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: | http://commits.kde.org/krita/02fefaaf1fa6aefc3f24a42ded3734fe47c34c2f | Version Fixed In: | |
Sentry Crash Report: |
Description
Alexander Opitz
2016-01-05 09:09:21 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. 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* Hi, bad news, I'm not allowed to send the PSD file out. :-( I can only tell, that it was generated with CS6. 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. 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. Definitely, but it will much easier to fix if we've got a file that triggers the issue. 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 :( Right... We looked into it today (Dmitry is visiting my place), but without a test file we cannot go on, I'm afraid. 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 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). 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 |