Bug 136103 - Krita fails to open when non-conforming ICC profile is present
Summary: Krita fails to open when non-conforming ICC profile is present
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 1.6
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2006-10-21 21:33 UTC by Hal V. Engel
Modified: 2008-10-26 11:08 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
non-conforming ICC profile (2.06 KB, application/octet-stream)
2006-10-21 21:57 UTC, Hal V. Engel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hal V. Engel 2006-10-21 21:33:58 UTC
Version:           1.6.0 (using KDE KDE 3.5.2)
Installed from:    Gentoo Packages
Compiler:          gcc 4.1.1 
OS:                Linux

When there is a non-conforming ICC profile in a profile directory such as ~/.color/icc Krita will go into a loop and never open.

I have a profile that I got from a user of my application (LProf) that does not conform to ICC standards.  This profile was shipped by the hardware vendor with a common scanner.  I have been using this profile for testing LProf code to make sure that non-conforming profiles do not cause problems.  When I installed Krita 1.6.0 and started it all it did was the following:

lcms: Error #4096; Read from memory error. Got 0 bytes, block should be of 2 bytes
lcms: Error #4096; Read from memory error. Got 0 bytes, block should be of 2 bytes
lcms: Error #4096; Read from memory error. Got 0 bytes, block should be of 2 bytes
lcms: Error #4096; Read from memory error. Got 0 bytes, block should be of 2 bytes
lcms: Error #4096; Read from memory error. Got 0 bytes, block should be of 2 bytes
lcms: Error #4096; Read from memory error. Got 0 bytes, block should be of 2 bytes
lcms: Error #4096; Read from memory error. Got 0 bytes, block should be of 2 bytes

I had to kill it to stop this.  I don't see any way to attach the profile to this bug report so that you can use it as a test case.  So please email me and I will send it to whoever needs it for testing.  By the way this same profile has been used by the Scribus team and and also the author of LCMS for testing.  LCMS 1.16 should have fixes that prevent this from happening when it is released.  I currently have LCMS 1.15 installed.

Also renaming the profile so that Krita did not try to open it made the problem go away.  But most users might not know what the cause is and how to work around it if they should happen to have a similar profile on their system.  Marti Maria has told me that he thinks that about 25% of the profiles out there are non-conforming in some way.  So this type of thing is a fairly common problem.
Comment 1 Cyrille Berger 2006-10-21 21:51:16 UTC
you can attach a file clicking on "Create a New attachment" at the bottom of the page (or send it to me at cyb@lepi.org). Do you know if there is a way in 1.15 to detect those profile ? The only check we do is wether lcms succeed to load the profile or not.
Comment 2 Bart Coppens 2006-10-21 21:56:12 UTC
Right, I was told about this by mrdocs, but iirc it was kinda late in the 1.6.0 cycle to start adding the code for that. Apparently Scribus has code for this that we should 'borrow' ;-)
You should be able to add the profile through http://bugs.kde.org/attachment.cgi?bugid=136103&action=enter to the bugreport, btw. I'm confirming this bug anyway (since we should sanity check), but it'd still be handy to have a testcase.
Comment 3 Hal V. Engel 2006-10-21 21:57:11 UTC
Created attachment 18218 [details]
non-conforming ICC profile

Here is the profile.  Sorry I missed the Create New Attachment button.
Comment 4 Hal V. Engel 2006-10-21 22:09:45 UTC
You have to use cmsSetErrorHandler from lcms to trap errors.  That way when lcms has some type of problem with a profile your error handler will be called and you can do whatever is needed.  In LProf I dump a message to the console and then by pass the profile that caused the error handler to be called.  My code is basically a clone of the code that Scribus impletented for this same type of thing.  Once you have this in place it will trap any profile errors that lcms detects that would otherwise cause it to do whatever action is set by cmsErrorAction (LCMS_ERROR_ABORT is default but it looks like Krita is using LCMS_ERROR_SHOW) 
Comment 5 Michael Leupold 2008-10-26 10:48:32 UTC
I just tried reproducing this error and it doesn't seem to be in KOffice2 (trunk r875799) any longer. I added the corrupted profile to ~/.local/share/color/icc/krita and krita doesn't loop (but seems to find the file).
Comment 6 Halla Rempt 2008-10-26 11:08:56 UTC
We do check for validity now, so this bug can be closed. Thanks!