|Summary:||RawEngine contains invalid icc profiles, applications fail to save png file with libpng-1.6.x|
|Product:||[Applications] digikam||Reporter:||Andreas K. Huettel <dilfridge>|
|Component:||Plugin-DImg-RAW||Assignee:||Digikam Developers <digikam-bugs-null>|
|Severity:||normal||CC:||caulier.gilles, digikam-bugs-null, johu, vivo75+kde|
|Latest Commit:||http://commits.kde.org/libkdcraw/92a57e163222ef9ee072964eb5cad92d9567a24d||Version Fixed In:||3.2.0|
Description Andreas K. Huettel 2013-05-03 10:47:08 UTC
Comment 1 Francesco Riosa 2013-05-03 10:51:57 UTC
I plan to look at this next weekend 4/5-05/2013
Comment 2 Francesco Riosa 2013-05-05 15:43:02 UTC
after some research seem libpng cannot handle srgb-d65.icm from libkdcraw
Comment 3 Andreas K. Huettel 2013-05-05 20:25:23 UTC
From the Gentoo bug report: --- Comment #8 from John Bowler <jbowler##acm.org> --- ICC profiles are required to have a length which is a multiple of 4, so the profile in question is broken. (See 7.1.2(c) in the spec and "NOTE 1" that follows it then read 7.2.2 - the length includes the pad bytes.) I believe there was (and maybe is) an app that was writing text strings at the end of the profile and, if the text string was not a multiple of 4 in length, it would produce a bad profile. Those profiles are easy to fix - just pad the string with \0 - but other bugs where the profile length is calculated wrong may result in serious errors. (libpng does go on to validate the length, but when the length is detectably broken at the start it simply rejects the profile.) This is a benign error on read and the profile will be ignored (along with any other colorspace information in the PNG) but on write it gets converted into an application error - we don't want to write PNGs with detectably broken profiles, something else may crash! The KDE upstream need to fix the profile, it should be easy.
Comment 4 Francesco Riosa 2013-05-06 10:04:22 UTC
krita in calligra also has some
Comment 5 Francesco Riosa 2013-05-06 16:43:05 UTC
Created attachment 79736 [details] srgb-d65.icm this profile has been padded with 0 to 6924 bytes (with okteta hex editor) and the header updated to the new size.
Comment 6 Francesco Riosa 2013-05-09 16:42:01 UTC
every upstream software (libpng and lcms) confirmed that icc profiles are padded to 4 byte and that the software involved is conformat since a looong time. so it's ok to simply replace the original profile with a padded one.
Comment 7 Francesco Riosa 2013-05-09 16:46:07 UTC
Git commit ca2274e40d065e12123f6d32db3c6fe153e621a2 by Francesco Riosa. Committed on 09/05/2013 at 18:41. Pushed by riosa into branch 'master'. ICC profiles should be padded to 4 bytes In practice with libpng >= 1.6 the profile cannot be embedded if it has the wrong size thus preventing digikam/showfoto to write png files at all. see also M +- -- profiles/srgb-d65.icm http://commits.kde.org/libkdcraw/ca2274e40d065e12123f6d32db3c6fe153e621a2
Comment 8 Francesco Riosa 2013-06-10 16:26:47 UTC
Git commit 92a57e163222ef9ee072964eb5cad92d9567a24d by Francesco Riosa. Committed on 09/05/2013 at 18:41. Pushed by riosa into branch 'KDE/4.10'. ICC profiles should be padded to 4 bytes In practice with libpng >= 1.6 the profile cannot be embedded if it has the wrong size thus preventing digikam/showfoto to write png files at all. see also M +- -- profiles/srgb-d65.icm http://commits.kde.org/libkdcraw/92a57e163222ef9ee072964eb5cad92d9567a24d