Bug 264837

Summary: Krita crash while opening tiff file
Product: [Applications] krita Reporter: Julien Tattevin <juluano>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: cberger, cfeck, halla
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: tiffinfo filename
Okular rendering of the same tiff file

Description Julien Tattevin 2011-01-30 12:58:48 UTC
Application: krita (2.4 Alpha 1)
KDE Platform Version: 4.6.00 (4.6.0) (Compiled from sources)
Qt Version: 4.7.0
Operating System: Linux 2.6.35-25-generic x86_64
Distribution: Ubuntu 10.10

-- Information about the crash:
I was trying to open a psd file with layer fx, convert it to tiff (convert file.psd file.tiff)
Then i tried to open it with krita (krita file.tiff)
and krita crash


krita(3116)/koffice (lib komain) KoPluginLoader::load: Loading plugin "Outils d'animation" failed,  "Impossible de charger la bibliothèque /usr/lib/kde4/kpresentertoolanimation.so : (/usr/lib/libkpresenterprivate.so.8: undefined symbol: _ZNK18KoShapeFactoryBase10metaObjectEv)" 
krita(3116)/krita (general) MyPaintBrushResource::load:          we only read version 2 .myb files 
krita(3116)/krita (general) MyPaintBrushResource::load:          we only read version 2 .myb files 
krita(3116)/krita (general) MyPaintBrushResource::load:          we only read version 2 .myb files 
(Soprano::Redland::BackendPlugin) creating model of type "hashes" with options "hash-type='memory',contexts='yes'" 
krita(3116)/kdeui (KAction) KActionCollection::setComponentData: this does not work on a KActionCollection containing actions! 
krita(3116)/koffice (filter manager) KoFilterManager::filterAvailable: The library  ""  does not offer a check_ ""  function. 

krita(3116)/krita (file handling) KisTIFFConverter::readTIFFDirectory: The profile  "IEC 61966-2.1 Default RGB colour space - sRGB"  is not compatible with the color space model  "GRAYA"   "U8" 
krita(3116)/krita (file handling) KisTIFFConverter::readTIFFDirectory: The profile  "gray built-in"  is not compatible with the color space model  "RGBA"   "U8" 
KCrash: Application 'krita' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/juluan/.kde/socket-juluan-desktop/kdeinit4__0

The crash can be reproduced every time.

-- Backtrace:
Application: Krita (krita), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f27eb3857a0 (LWP 3089))]

Thread 3 (Thread 0x7f27be399700 (LWP 3093)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f27eab8ce3b in wait (this=<value optimized out>, mutex=0x49549a0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:88
#2  QWaitCondition::wait (this=<value optimized out>, mutex=0x49549a0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:160
#3  0x00007f27eab88b0b in QSemaphore::acquire (this=0x4be0b20, n=1) at thread/qsemaphore.cpp:144
#4  0x00007f27ea282a0e in KisTileDataPooler::waitForWork (this=0x4be0b10) at /home/juluan/Documents/koffice/krita/image/tiles3/kis_tile_data_pooler.cc:127
#5  0x00007f27ea282c58 in KisTileDataPooler::run (this=0x4be0b10) at /home/juluan/Documents/koffice/krita/image/tiles3/kis_tile_data_pooler.cc:156
#6  0x00007f27eab8c27e in QThreadPrivate::start (arg=0x4be0b10) at thread/qthread_unix.cpp:266
#7  0x00007f27e9274953 in ?? () from /usr/lib/nvidia-current/libGL.so.1
#8  0x00007f27e2766971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#9  0x00007f27e2a6292d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f27bdb98700 (LWP 3094)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f27eab8ce3b in wait (this=<value optimized out>, mutex=0x4914580, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:88
#2  QWaitCondition::wait (this=<value optimized out>, mutex=0x4914580, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:160
#3  0x00007f27eab88dab in QSemaphore::tryAcquire (this=0x4bf4450, n=1, timeout=<value optimized out>) at thread/qsemaphore.cpp:221
#4  0x00007f27ea29fa7a in KisTileDataSwapper::run (this=0x4be0b40) at /home/juluan/Documents/koffice/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:90
#5  0x00007f27eab8c27e in QThreadPrivate::start (arg=0x4be0b40) at thread/qthread_unix.cpp:266
#6  0x00007f27e9274953 in ?? () from /usr/lib/nvidia-current/libGL.so.1
#7  0x00007f27e2766971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#8  0x00007f27e2a6292d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f27eb3857a0 (LWP 3089)):
[KCrash Handler]
#6  0x00007f27e3250146 in __dynamic_cast () from /usr/lib/libstdc++.so.6
#7  0x00007f27c84a1b86 in LcmsColorSpaceFactory::profileIsCompatible (this=0x1e6f7a0, profile=0x91) at /home/juluan/Documents/koffice/plugins/colorengines/lcms2/LcmsColorSpace.h:427
#8  0x00007f27be3a26a2 in KisTIFFConverter::readTIFFDirectory (this=<value optimized out>, image=0x4ba1850) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_converter.cc:261
#9  0x00007f27be3a56d6 in KisTIFFConverter::decode (this=0x7fff85db9aa0, uri=<value optimized out>) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_converter.cc:169
#10 0x00007f27be3a590f in KisTIFFConverter::buildImage (this=0x7fff85db9aa0, uri=<value optimized out>) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_converter.cc:564
#11 0x00007f27be3aa6a4 in KisTIFFImport::convert (this=<value optimized out>, to=<value optimized out>) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_import.cc:79
#12 0x00007f27e9a7d582 in KOfficeFilter::ChainLink::invokeFilter (this=0x4b3c0e0, parentChainLink=0x0) at /home/juluan/Documents/koffice/libs/main/KoFilterChainLink.cpp:90
#13 0x00007f27e9a73abb in KoFilterChain::invokeChain (this=0x4b724b0) at /home/juluan/Documents/koffice/libs/main/KoFilterChain.cpp:94
#14 0x00007f27e9a71a08 in KoFilterManager::importDocument (this=0x492d080, url=<value optimized out>, status=<value optimized out>) at /home/juluan/Documents/koffice/libs/main/KoFilterManager.cpp:164
#15 0x00007f27e9a21408 in KoDocument::openFile (this=0x4a80bb0) at /home/juluan/Documents/koffice/libs/main/KoDocument.cpp:1339
#16 0x00007f27e9777770 in ?? () from /usr/lib/libkparts.so.4
#17 0x00007f27e9778115 in KParts::ReadOnlyPart::openUrl(KUrl const&) () from /usr/lib/libkparts.so.4
#18 0x00007f27e9a2027c in KoDocument::openUrl (this=0x4a80bb0, _url=...) at /home/juluan/Documents/koffice/libs/main/KoDocument.cpp:1253
#19 0x00007f27e9a43de7 in KoMainWindow::openDocumentInternal (this=0x1949650, url=..., newdoc=0x4a80bb0) at /home/juluan/Documents/koffice/libs/main/KoMainWindow.cpp:678
#20 0x00007f27e9a44c9a in KoMainWindow::openDocument (this=0x1949650, newdoc=0x4a80bb0, url=...) at /home/juluan/Documents/koffice/libs/main/KoMainWindow.cpp:661
#21 0x00007f27e9a138cd in KoApplication::start (this=<value optimized out>) at /home/juluan/Documents/koffice/libs/main/KoApplication.cpp:252
#22 0x00007f27eafb62e3 in kdemain (argc=<value optimized out>, argv=<value optimized out>) at /home/juluan/Documents/koffice/krita/main.cc:46
#23 0x00007f27e299ad8e in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fff85dbb1f8) at libc-start.c:226
#24 0x00000000004008a9 in _start ()

Reported using DrKonqi
Comment 1 Halla Rempt 2011-01-30 13:43:22 UTC
Hi! Thanks for your report. Is it possible for you to attach the file to the bug report, or, if it's too big, to send it to me (boud@valdyas.org)?
Comment 2 Christoph Feck 2011-01-30 16:35:07 UTC
> undefined symbol: _ZNK18KoShapeFactoryBase10metaObjectEv

This is a problem in your installation. Either you are mixing packages from different repositories, or you have self-compiled packages mixed with repository packages. Please install KOffice/Calligra packages from a single source.
Comment 3 Julien Tattevin 2011-01-30 22:32:02 UTC
Ok, i removed package binarie, remade my koffice installation, but still ...


krita(2789)/krita (general) MyPaintBrushResource::load:          we only read version 2 .myb files 
krita(2789)/krita (general) MyPaintBrushResource::load:          we only read version 2 .myb files 
krita(2789)/krita (general) MyPaintBrushResource::load:          we only read version 2 .myb files 
(Soprano::Redland::BackendPlugin) creating model of type "hashes" with options "hash-type='memory',contexts='yes'" 
krita(2789)/kdeui (KAction) KActionCollection::setComponentData: this does not work on a KActionCollection containing actions!                                                                                                                      
krita(2789)/koffice (filter manager) KoFilterManager::filterAvailable: The library  ""  does not offer a check_ ""  function.                                                                                                                       

krita(2789)/krita (file handling) KisTIFFConverter::readTIFFDirectory: The profile  "IEC 61966-2.1 Default RGB colour space - sRGB"  is not compatible with the color space model  "GRAYA"   "U8" 
krita(2789)/krita (file handling) KisTIFFConverter::readTIFFDirectory: The profile  "gray built-in"  is not compatible with the color space model  "RGBA"   "U8" 
KCrash: Application 'krita' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/juluan/.kde/socket-juluan-desktop/kdeinit4__0





And the new backtrace :
Application: Krita (krita), signal: Segmentation fault
[Current thread is 1 (Thread 0x7fd9bb8da7a0 (LWP 2789))]

Thread 3 (Thread 0x7fd98ae55700 (LWP 2793)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fd9bb0e0e3b in wait (this=<value optimized out>, mutex=0x4c5d740, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:88
#2  QWaitCondition::wait (this=<value optimized out>, mutex=0x4c5d740, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:160
#3  0x00007fd9bb0dcb0b in QSemaphore::acquire (this=0x4e30c90, n=1) at thread/qsemaphore.cpp:144
#4  0x00007fd9ba7d6a0e in KisTileDataPooler::waitForWork (this=0x4e30c80) at /home/juluan/Documents/koffice/krita/image/tiles3/kis_tile_data_pooler.cc:127
#5  0x00007fd9ba7d6c58 in KisTileDataPooler::run (this=0x4e30c80) at /home/juluan/Documents/koffice/krita/image/tiles3/kis_tile_data_pooler.cc:156
#6  0x00007fd9bb0e027e in QThreadPrivate::start (arg=0x4e30c80) at thread/qthread_unix.cpp:266
#7  0x00007fd9b97c8953 in ?? () from /usr/lib/nvidia-current/libGL.so.1
#8  0x00007fd9b2cba971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#9  0x00007fd9b2fb692d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fd98a654700 (LWP 2794)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fd9bb0e0e3b in wait (this=<value optimized out>, mutex=0x4b43340, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:88
#2  QWaitCondition::wait (this=<value optimized out>, mutex=0x4b43340, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:160
#3  0x00007fd9bb0dcdab in QSemaphore::tryAcquire (this=0x4e31470, n=1, timeout=<value optimized out>) at thread/qsemaphore.cpp:221
#4  0x00007fd9ba7f3a7a in KisTileDataSwapper::run (this=0x4e30cb0) at /home/juluan/Documents/koffice/krita/image/tiles3/swap/kis_tile_data_swapper.cpp:90
#5  0x00007fd9bb0e027e in QThreadPrivate::start (arg=0x4e30cb0) at thread/qthread_unix.cpp:266
#6  0x00007fd9b97c8953 in ?? () from /usr/lib/nvidia-current/libGL.so.1
#7  0x00007fd9b2cba971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#8  0x00007fd9b2fb692d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fd9bb8da7a0 (LWP 2789)):
[KCrash Handler]
#6  0x00007fd9b37a4146 in __dynamic_cast () from /usr/lib/libstdc++.so.6
#7  0x00007fd998b4bb86 in LcmsColorSpaceFactory::profileIsCompatible (this=0x2077180, profile=0x91) at /home/juluan/Documents/koffice/plugins/colorengines/lcms2/LcmsColorSpace.h:427
#8  0x00007fd98e91d6a2 in KisTIFFConverter::readTIFFDirectory (this=<value optimized out>, image=0x4dd8ad0) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_converter.cc:261
#9  0x00007fd98e9206d6 in KisTIFFConverter::decode (this=0x7fff266b0da0, uri=<value optimized out>) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_converter.cc:169
#10 0x00007fd98e92090f in KisTIFFConverter::buildImage (this=0x7fff266b0da0, uri=<value optimized out>) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_converter.cc:564
#11 0x00007fd98e9256a4 in KisTIFFImport::convert (this=<value optimized out>, to=<value optimized out>) at /home/juluan/Documents/koffice/krita/plugins/formats/tiff/kis_tiff_import.cc:79
#12 0x00007fd9b9fd1582 in KOfficeFilter::ChainLink::invokeFilter (this=0x4de18b0, parentChainLink=0x0) at /home/juluan/Documents/koffice/libs/main/KoFilterChainLink.cpp:90
#13 0x00007fd9b9fc7abb in KoFilterChain::invokeChain (this=0x4de19d0) at /home/juluan/Documents/koffice/libs/main/KoFilterChain.cpp:94
#14 0x00007fd9b9fc5a08 in KoFilterManager::importDocument (this=0x4b246f0, url=<value optimized out>, status=<value optimized out>) at /home/juluan/Documents/koffice/libs/main/KoFilterManager.cpp:164
#15 0x00007fd9b9f75408 in KoDocument::openFile (this=0x4c841e0) at /home/juluan/Documents/koffice/libs/main/KoDocument.cpp:1339
#16 0x00007fd9b9ccb770 in ?? () from /usr/lib/libkparts.so.4
#17 0x00007fd9b9ccc115 in KParts::ReadOnlyPart::openUrl(KUrl const&) () from /usr/lib/libkparts.so.4
#18 0x00007fd9b9f7427c in KoDocument::openUrl (this=0x4c841e0, _url=...) at /home/juluan/Documents/koffice/libs/main/KoDocument.cpp:1253
#19 0x00007fd9b9f97de7 in KoMainWindow::openDocumentInternal (this=0x1b4c030, url=..., newdoc=0x4c841e0) at /home/juluan/Documents/koffice/libs/main/KoMainWindow.cpp:678
#20 0x00007fd9b9f98c9a in KoMainWindow::openDocument (this=0x1b4c030, newdoc=0x4c841e0, url=...) at /home/juluan/Documents/koffice/libs/main/KoMainWindow.cpp:661
#21 0x00007fd9b9f678cd in KoApplication::start (this=<value optimized out>) at /home/juluan/Documents/koffice/libs/main/KoApplication.cpp:252
#22 0x00007fd9bb50a2e3 in kdemain (argc=<value optimized out>, argv=<value optimized out>) at /home/juluan/Documents/koffice/krita/main.cc:46
#23 0x00007fd9b2eeed8e in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fff266b24f8) at libc-start.c:226
#24 0x00000000004008a9 in _start ()
Comment 4 Halla Rempt 2011-01-31 09:18:31 UTC
That looks like there really is something weird with that file.
Comment 5 Julien Tattevin 2011-01-31 22:42:55 UTC
It's too big (and private) for me to share it, but i try to make a light one who make the same crash but i don't have succeed yet ...
Comment 6 Cyrille Berger 2011-02-01 13:46:08 UTC
I suspect something wrong with the embedded color profile.

Can you run "tiffinfo filename" (from the package libtiff-tools, or something like that) and paste the output here.

Also if the output countains something like this:
  ICC Profile: <present>, 3144 bytes

I would need you to use tifficc to extract the ICC profile from the tiff:
tifficc  -sprofile.icc filename.tiff output.tiff

(be carefull that output.tiff is going to be erased, your original file is untouched). Then if you could attach "profile.icc", I should be able to reconstruct an image that hopefully expose the problem.


I would also like to have some confirmation on the version you are using ? Since your bug report mention "2.4 alpha 1", but the source code comes from koffice which does not have krita 2.4 alpha 1.
Comment 7 Julien Tattevin 2011-02-01 21:29:56 UTC
Created attachment 56760 [details]
tiffinfo filename

The tiffinfo result as attachment, and

tifficc  -sprofile.icc filename.tiff output.tiff

Return me : Error TIFFICC: Couldn't allocate 139801185487944 bytes for profile.
So i couldn't run it ...

I tried to to remove thing from my original PSD file, but i got another backtrace.

The file contain multiple image from different source and not all on the same color profile. So it may be my file which is badly made (made for print but not all on CMJN and 300DPI). I will try to clean it and retest.
Comment 8 Julien Tattevin 2011-02-01 21:43:55 UTC
Created attachment 56761 [details]
Okular rendering of the same tiff file

A little more information, while opening it with gwenview, no problem at all,
And okular give me something special :
i got the first page which is the final picture, some page after, the two you see on the screenshot and after everything is white and the last is very very very long ... the page scroll start from the rod mark until the end, just for one page

(Sorry if i'm not understable)
Comment 9 Cyrille Berger 2011-02-02 10:19:29 UTC
Sounds like tifficc does not like multiple-page tiffs. I just tried and got the same result. If you have the time, can you try to export each layer a seperate tiff and extract the profile of each of the seperate tiff ?

Also maybe try to create an other photoshop document, with multiple layer, export it and see if it crashes krita ?

Last question, are the image inside your tiff using different colorspace ? (like RGB and grayscale ? on a side note, I just tried, and it seems krita is not able to open a tiff image that mix RGB and grayscale, it might explain a problem). But the okular result is quiet worrysome.
Comment 10 Julien Tattevin 2011-02-03 22:12:21 UTC
I will remove anything private and send the file, it will be best for you ...
Is megaupload nice to you or do you prefer another system ? The file is 16M 

I tried to redo the same thing with another tiff file, but it worked nice.
(But with some problem rendering mask and other photoshop layer fx ...)

Inside there is : grayscale (i think for text) RGB (picture i imported) and CMJN (document destinated to be printed).
Comment 11 Julien Tattevin 2011-02-05 13:30:41 UTC
Ok, this is the psd.
http://www.megaupload.com/?d=9H9CA2YY


And for converting from one to another, i use :
$ convert --version
Version: ImageMagick 6.6.2-6 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
Comment 12 Cyrille Berger 2011-02-07 14:03:43 UTC
Got a crash when running convert... But seems like I got a resulting cv.tiff that is not complete, but still crashes krita, while working in other application, so I should have something to be able to investigate.
Comment 13 Cyrille Berger 2011-02-12 17:09:58 UTC
Git commit e4edac1897872c578685f3a16e2b6976ac8418f4 by Cyrille Berger.
Committed on 12/02/2011 at 17:07.
Pushed by berger into branch 'master'.

Fix: crash when opening files that have a profile that is not compatible with their color space

BUG:264837

M  +0    -1    krita/plugins/formats/jpeg/kis_jpeg_converter.cc     
M  +1    -1    krita/plugins/formats/tiff/kis_tiff_converter.cc     
M  +0    -1    krita/ui/kis_png_converter.cpp     

http://commits.kde.org/calligra/e4edac1897872c578685f3a16e2b6976ac8418f4